Fossil SCM
Prevent a crash in fossil during exit, when a mingw-compiled (with dw2) Tcl version is still loaded. This is clearly a dw2 bug (see: [http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724]), but the suggested workaround works and is managable.
Commit
da96f916cb02bdb94f9c4b457b377a954b176cd3
Parent
aad3ef32885dd1c…
1 file changed
+10
+10
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -344,10 +344,20 @@ | ||
| 344 | 344 | /* |
| 345 | 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | 346 | ** used by fossil. |
| 347 | 347 | */ |
| 348 | 348 | static void fossil_atexit(void) { |
| 349 | +#if defined(_WIN32) && defined(USE_TCL_STUBS) | |
| 350 | + /* If Tcl is compiled on win32 using the latest mingw, | |
| 351 | + * fossil crashes when exiting while Tcl is still loaded. | |
| 352 | + * That's a bug in mingw, see: | |
| 353 | + * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> | |
| 354 | + * but the workaround is not that bad at all: */ | |
| 355 | + if( g.tcl.library ){ | |
| 356 | + FreeLibrary(g.tcl.library); | |
| 357 | + } | |
| 358 | +#endif | |
| 349 | 359 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | 360 | cson_value_free(g.json.gc.v); |
| 351 | 361 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | 362 | #endif |
| 353 | 363 | free(g.zErrMsg); |
| 354 | 364 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #ifdef FOSSIL_ENABLE_JSON |
| 350 | cson_value_free(g.json.gc.v); |
| 351 | memset(&g.json, 0, sizeof(g.json)); |
| 352 | #endif |
| 353 | free(g.zErrMsg); |
| 354 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -344,10 +344,20 @@ | |
| 344 | /* |
| 345 | ** atexit() handler which frees up "some" of the resources |
| 346 | ** used by fossil. |
| 347 | */ |
| 348 | static void fossil_atexit(void) { |
| 349 | #if defined(_WIN32) && defined(USE_TCL_STUBS) |
| 350 | /* If Tcl is compiled on win32 using the latest mingw, |
| 351 | * fossil crashes when exiting while Tcl is still loaded. |
| 352 | * That's a bug in mingw, see: |
| 353 | * <http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724> |
| 354 | * but the workaround is not that bad at all: */ |
| 355 | if( g.tcl.library ){ |
| 356 | FreeLibrary(g.tcl.library); |
| 357 | } |
| 358 | #endif |
| 359 | #ifdef FOSSIL_ENABLE_JSON |
| 360 | cson_value_free(g.json.gc.v); |
| 361 | memset(&g.json, 0, sizeof(g.json)); |
| 362 | #endif |
| 363 | free(g.zErrMsg); |
| 364 |