summarylogtreecommitdiffstats
path: root/tk-prevent-tclStubsPtr-segfault.patch
blob: 565be39414a8b12d3880c68351e16a9d41014d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff -Naur tk8.6.5-orig/generic/tkEvent.c tk8.6.5/generic/tkEvent.c
--- tk8.6.5-orig/generic/tkEvent.c	2016-02-16 21:21:01.000000000 +0300
+++ tk8.6.5/generic/tkEvent.c	2016-03-03 09:21:53.281037200 +0300
@@ -2045,7 +2045,16 @@
     }
 #endif
 
-    Tcl_DeleteExitHandler(TkFinalize, NULL);
+    /* There's no guarantee that Tcl_InitStubs
+     * has been called before exit; tclStubsPtr
+     * is NULL in this case.
+     */
+#if defined(USE_TCL_STUBS)
+    if (tclStubsPtr == NULL)
+	    return;
+#endif
+
+	Tcl_DeleteExitHandler(TkFinalize, NULL);
 
     Tcl_MutexLock(&exitMutex);
     for (exitPtr = firstExitPtr; exitPtr != NULL; exitPtr = firstExitPtr) {