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.

jan.nijtmans 2013-09-23 10:17 trunk
Commit da96f916cb02bdb94f9c4b457b377a954b176cd3
1 file changed +10
+10
--- src/main.c
+++ src/main.c
@@ -344,10 +344,20 @@
344344
/*
345345
** atexit() handler which frees up "some" of the resources
346346
** used by fossil.
347347
*/
348348
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
349359
#ifdef FOSSIL_ENABLE_JSON
350360
cson_value_free(g.json.gc.v);
351361
memset(&g.json, 0, sizeof(g.json));
352362
#endif
353363
free(g.zErrMsg);
354364
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button