File tree 3 files changed +22
-8
lines changed
3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -1092,10 +1092,11 @@ extern "C" {
1092
1092
#endif
1093
1093
1094
1094
/*
1095
- * Themed widget set init function:
1095
+ * Themed widget set init function, and handler called when Tk is destroyed.
1096
1096
*/
1097
1097
1098
1098
MODULE_SCOPE int Ttk_Init (Tcl_Interp * interp );
1099
+ MODULE_SCOPE void Ttk_TkDestroyedHandler (Tcl_Interp * interp );
1099
1100
1100
1101
/*
1101
1102
* Internal functions shared among Tk modules but not exported to the outside
Original file line number Diff line number Diff line change @@ -1621,6 +1621,7 @@ Tk_DestroyWindow(
1621
1621
TkFontPkgFree (winPtr -> mainPtr );
1622
1622
TkFocusFree (winPtr -> mainPtr );
1623
1623
TkStylePkgFree (winPtr -> mainPtr );
1624
+ Ttk_TkDestroyedHandler (winPtr -> mainPtr -> interp );
1624
1625
1625
1626
/*
1626
1627
* When embedding Tk into other applications, make sure that all
Original file line number Diff line number Diff line change @@ -417,13 +417,6 @@ static void Ttk_StylePkgFree(
417
417
Tcl_HashEntry * entryPtr ;
418
418
Cleanup * cleanup ;
419
419
420
- /*
421
- * Cancel any pending ThemeChanged calls:
422
- */
423
- if (pkgPtr -> themeChangePending ) {
424
- Tcl_CancelIdleCall (ThemeChangedProc , pkgPtr );
425
- }
426
-
427
420
/*
428
421
* Free themes.
429
422
*/
@@ -531,6 +524,25 @@ static void ThemeChanged(StylePackageData *pkgPtr)
531
524
}
532
525
}
533
526
527
+ /* Ttk_TkDestroyedHandler --
528
+ * See bug [310c74ecf440]: idle calls to ThemeChangedProc()
529
+ * need to be canceled when Tk is destroyed, since the interp
530
+ * may still be active afterward; canceling them from
531
+ * Ttk_StylePkgFree() would be too late.
532
+ */
533
+ void Ttk_TkDestroyedHandler (
534
+ Tcl_Interp * interp )
535
+ {
536
+ StylePackageData * pkgPtr = GetStylePackageData (interp );
537
+
538
+ /*
539
+ * Cancel any pending ThemeChanged calls:
540
+ */
541
+ if (pkgPtr -> themeChangePending ) {
542
+ Tcl_CancelIdleCall (ThemeChangedProc , pkgPtr );
543
+ }
544
+ }
545
+
534
546
/*
535
547
* Ttk_CreateTheme --
536
548
* Create a new theme and register it in the global theme table.
You can’t perform that action at this time.
0 commit comments