summaryrefslogtreecommitdiffstats
path: root/generic/tkMenu.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2003-02-26 02:32:55 (GMT)
committerhobbs <hobbs@noemail.net>2003-02-26 02:32:55 (GMT)
commiteae2978277d3a14de93626ddc38282d361212369 (patch)
treea96d39e32fb10e92b487a383610cf76aa3bc3567 /generic/tkMenu.c
parent85b8b682df66719ff7a3f243336cce050ed89805 (diff)
downloadtk-eae2978277d3a14de93626ddc38282d361212369.zip
tk-eae2978277d3a14de93626ddc38282d361212369.tar.gz
tk-eae2978277d3a14de93626ddc38282d361212369.tar.bz2
* generic/tkMenu.c (TkMenuCleanup): make sure to reset static
menusInitialized on finalize. [Bug #548729] FossilOrigin-Name: 70cc1ff0649cb673ee672027f8a94065bb7f1536
Diffstat (limited to 'generic/tkMenu.c')
-rw-r--r--generic/tkMenu.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 7ed2d94..152e57f 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMenu.c,v 1.19 2002/08/05 04:30:40 dgp Exp $
+ * RCS: @(#) $Id: tkMenu.c,v 1.20 2003/02/26 02:32:56 hobbs Exp $
*/
/*
@@ -370,6 +370,7 @@ static void MenuWorldChanged _ANSI_ARGS_((
static int PostProcessEntry _ANSI_ARGS_((TkMenuEntry *mePtr));
static void RecursivelyDeleteMenu _ANSI_ARGS_((TkMenu *menuPtr));
static void UnhookCascadeEntry _ANSI_ARGS_((TkMenuEntry *mePtr));
+static void TkMenuCleanup _ANSI_ARGS_((ClientData unused));
/*
* The structure below is a list of procs that respond to certain window
@@ -3455,6 +3456,29 @@ DeleteMenuCloneEntries(menuPtr, first, last)
/*
*----------------------------------------------------------------------
*
+ * TkMenuCleanup --
+ *
+ * Resets menusInitialized to allow Tk to be finalized and reused
+ * without the DLL being unloaded.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TkMenuCleanup(ClientData unused)
+{
+ menusInitialized = 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkMenuInit --
*
* Sets up the hash tables and the variables used by the menu package.
@@ -3474,13 +3498,17 @@ TkMenuInit()
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-
+
if (!menusInitialized) {
Tcl_MutexLock(&menuMutex);
if (!menusInitialized) {
TkpMenuInit();
menusInitialized = 1;
}
+ /*
+ * Make sure we cleanup on finalize.
+ */
+ Tcl_CreateExitHandler((Tcl_ExitProc *) TkMenuCleanup, NULL);
Tcl_MutexUnlock(&menuMutex);
}
if (!tsdPtr->menusInitialized) {