diff options
author | hobbs <hobbs@noemail.net> | 2002-12-06 23:29:36 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2002-12-06 23:29:36 (GMT) |
commit | cb66c30ad8c020fa4cef7847ba2a277d58a20aaa (patch) | |
tree | 5929fe9f8d605ca8e874bea4a8c835657cd5367d | |
parent | f23e231836bb4de46968d8fff0c4748e295f24d4 (diff) | |
download | tk-cb66c30ad8c020fa4cef7847ba2a277d58a20aaa.zip tk-cb66c30ad8c020fa4cef7847ba2a277d58a20aaa.tar.gz tk-cb66c30ad8c020fa4cef7847ba2a277d58a20aaa.tar.bz2 |
* win/tkWinX.c (TkWinXInit): Move cleanup into an exit handler
* win/tkWin32Dll.c (DllMain): to ensure that it will be called
* win/tkWinWm.c (TkWinWmCleanup): without having to unload the dll.
Also reset the static int initialized on cleanup to allow reinit.
FossilOrigin-Name: f4d362d9f2b0cfab700ab4f1b951f2a665b86318
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | win/tkWin32Dll.c | 23 | ||||
-rw-r--r-- | win/tkWinWm.c | 7 | ||||
-rw-r--r-- | win/tkWinX.c | 8 |
4 files changed, 27 insertions, 18 deletions
@@ -1,3 +1,10 @@ +2002-12-06 Jeff Hobbs <jeffh@ActiveState.com> + + * win/tkWinX.c (TkWinXInit): Move cleanup into an exit handler + * win/tkWin32Dll.c (DllMain): to ensure that it will be called + * win/tkWinWm.c (TkWinWmCleanup): without having to unload the dll. + Also reset the static int initialized on cleanup to allow reinit. + 2002-12-01 Mo DeJong <mdejong@users.sourceforge.net> * tests/event.test (_keypress, _text_ind_to_x_y): diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index cc77be7..c8e03c1 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWin32Dll.c,v 1.4 2000/03/31 09:24:26 hobbs Exp $ + * RCS: @(#) $Id: tkWin32Dll.c,v 1.5 2002/12/06 23:29:37 hobbs Exp $ */ #include "tkWinInt.h" @@ -52,10 +52,13 @@ DllEntryPoint(hInst, reason, reserved) * * DllMain -- * - * DLL entry point. + * DLL entry point. It is not necessary to do anything here as + * Tk will initialize and clean up after itself through other + * methods, in order to be consistent whether the build is static + * or dynamic. * * Results: - * TRUE on sucess, FALSE on failure. + * Always TRUE. * * Side effects: * None. @@ -69,17 +72,5 @@ DllMain(hInstance, reason, reserved) DWORD reason; LPVOID reserved; { - - /* - * If we are attaching to the DLL from a new process, tell Tk about - * the hInstance to use. If we are detaching then clean up any - * data structures related to this DLL. - */ - - if (reason == DLL_PROCESS_ATTACH) { - TkWinXInit(hInstance); - } else if (reason == DLL_PROCESS_DETACH) { - TkWinXCleanup(hInstance); - } - return(TRUE); + return (TRUE); } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 8442881..69a4bd5 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.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: tkWinWm.c,v 1.53 2002/12/01 23:37:54 mdejong Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.54 2002/12/06 23:29:37 hobbs Exp $ */ #include "tkWinInt.h" @@ -1680,6 +1680,11 @@ TkWinWmCleanup(hInstance) } #endif + if (!initialized) { + return; + } + initialized = 0; + tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); diff --git a/win/tkWinX.c b/win/tkWinX.c index 9de5da3..f97db04 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinX.c,v 1.23 2002/06/19 19:37:55 mdejong Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.24 2002/12/06 23:29:37 hobbs Exp $ */ #include "tkWinInt.h" @@ -249,6 +249,12 @@ TkWinXInit(hInstance) if (!RegisterClass(&childClass)) { panic("Unable to register TkChild class"); } + + /* + * Make sure we cleanup on finalize. + */ + Tcl_CreateExitHandler((Tcl_ExitProc *) TkWinXCleanup, + (ClientData) hInstance); } /* |