From 891029fe3efdaa4b484b55a7d937c4e2d39b7722 Mon Sep 17 00:00:00 2001 From: hobbs Date: Fri, 3 Jan 2003 22:43:45 +0000 Subject: * generic/tkFrame.c (CreateFrame): throw a Tcl error instead of a panic when we cannot get a main window and appname is NULL. This can indicate that a user tried to create a frame/toplevel while Tk was dying. [Bug #661792] --- ChangeLog | 7 +++++++ generic/tkFrame.c | 14 ++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2381229..22f3287 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-01-03 Jeff Hobbs + + * generic/tkFrame.c (CreateFrame): throw a Tcl error instead of a + panic when we cannot get a main window and appname is NULL. This + can indicate that a user tried to create a frame/toplevel while Tk + was dying. [Bug #661792] + 2002-12-27 David Gravereaux * generic/tkText.h: ANSI unfriendly typedef for TkTextBTree diff --git a/generic/tkFrame.c b/generic/tkFrame.c index d5ed063..63e8245 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.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: tkFrame.c,v 1.13 2002/08/05 04:30:38 dgp Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.14 2003/01/03 22:43:45 hobbs Exp $ */ #include "default.h" @@ -565,14 +565,20 @@ CreateFrame(clientData, interp, objc, objv, type, appName) if (tkwin != NULL) { new = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]), screenName); + } else if (appName == NULL) { + /* + * This occurs when someone tried to create a frame/toplevel + * while we are being destroyed. Let an error be thrown. + */ + + Tcl_AppendResult(interp, "unable to create widget \"", + Tcl_GetString(objv[1]), "\"", (char *) NULL); + new = NULL; } else { /* * We were called from Tk_Init; create a new application. */ - if (appName == NULL) { - panic("TkCreateFrame didn't get application name"); - } new = TkCreateMainWindow(interp, screenName, appName); } if (new == NULL) { -- cgit v0.12