From dc35a1319208a687801cc6633b91a4c2bd13f8a3 Mon Sep 17 00:00:00 2001 From: chengyemao Date: Fri, 17 Dec 2004 14:27:18 +0000 Subject: bug fix (831627) --- generic/tkWindow.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 3172d81..c71f8a0 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.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: tkWindow.c,v 1.64 2004/03/26 14:45:07 dkf Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.65 2004/12/17 14:27:18 chengyemao Exp $ */ #include "tkPort.h" @@ -355,12 +355,6 @@ CreateTopLevelWindow(interp, parent, name, screenName, flags) Tk_CreatePhotoImageFormat(&tkImgFmtGIF); Tk_CreatePhotoImageFormat(&tkImgFmtPPM); - /* - * Create exit handler to delete all windows when the application - * exits. - */ - - TkCreateExitHandler(DeleteWindowsExitProc, (ClientData) tsdPtr); } if ((parent != NULL) && (screenName != NULL) && (screenName[0] == '\0')) { @@ -3161,6 +3155,17 @@ Initialize(interp) */ code = TkpInit(interp); + if(code != TCL_OK) { + goto done; + } + + /* + * Create exit handler to delete all windows when the application + * exits. This handler needs to be invoked before other platform + * specific cleanups take place to avoid panics in finalization. + */ + + TkCreateExitHandler(DeleteWindowsExitProc, (ClientData) tsdPtr); done: if (argv != NULL) { -- cgit v0.12