Debian Codegraph @

Mac/BuildScript/backport_gh71383_fix.patch

raw
1 Adapted from https://core.tcl-lang.org/tk/info/b1876b9ebc4b
2
3 Index: generic/tkInt.h
4 ==================================================================
5 --- a/generic/tkInt.h.orig
6 +++ b/generic/tkInt.h
7 @@ -1094,10 +1094,11 @@
8 /*
9 * Themed widget set init function:
10 */
11
12 MODULE_SCOPE int Ttk_Init(Tcl_Interp *interp);
13 +MODULE_SCOPE void Ttk_TkDestroyedHandler(Tcl_Interp *interp);
14
15 /*
16 * Internal functions shared among Tk modules but not exported to the outside
17 * world:
18 */
19
20 Index: generic/tkWindow.c
21 ==================================================================
22 --- a/generic/tkWindow.c.orig
23 +++ b/generic/tkWindow.c
24 @@ -1619,10 +1619,11 @@
25 TkBindFree(winPtr->mainPtr);
26 TkDeleteAllImages(winPtr->mainPtr);
27 TkFontPkgFree(winPtr->mainPtr);
28 TkFocusFree(winPtr->mainPtr);
29 TkStylePkgFree(winPtr->mainPtr);
30 + Ttk_TkDestroyedHandler(winPtr->mainPtr->interp);
31
32 /*
33 * When embedding Tk into other applications, make sure that all
34 * destroy events reach the server. Otherwise the embedding
35 * application may also attempt to destroy the windows, resulting
36
37 Index: generic/ttk/ttkTheme.c
38 ==================================================================
39 --- a/generic/ttk/ttkTheme.c.orig
40 +++ b/generic/ttk/ttkTheme.c
41 @@ -415,17 +415,10 @@
42 StylePackageData *pkgPtr = (StylePackageData *)clientData;
43 Tcl_HashSearch search;
44 Tcl_HashEntry *entryPtr;
45 Cleanup *cleanup;
46
47 - /*
48 - * Cancel any pending ThemeChanged calls:
49 - */
50 - if (pkgPtr->themeChangePending) {
51 - Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr);
52 - }
53 -
54 /*
55 * Free themes.
56 */
57 entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search);
58 while (entryPtr != NULL) {
59 @@ -528,10 +521,29 @@
60 if (!pkgPtr->themeChangePending) {
61 Tcl_DoWhenIdle(ThemeChangedProc, pkgPtr);
62 pkgPtr->themeChangePending = 1;
63 }
64 }
65 +
66 +/* Ttk_TkDestroyedHandler --
67 + * See bug [310c74ecf440]: idle calls to ThemeChangedProc()
68 + * need to be canceled when Tk is destroyed, since the interp
69 + * may still be active afterward; canceling them from
70 + * Ttk_StylePkgFree() would be too late.
71 + */
72 +void Ttk_TkDestroyedHandler(
73 + Tcl_Interp* interp)
74 +{
75 + StylePackageData* pkgPtr = GetStylePackageData(interp);
76 +
77 + /*
78 + * Cancel any pending ThemeChanged calls:
79 + */
80 + if (pkgPtr->themeChangePending) {
81 + Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr);
82 + }
83 +}
84
85 /*
86 * Ttk_CreateTheme --
87 * Create a new theme and register it in the global theme table.
88 *
89