From eaa472eda7c92abd87df99c5208082825dbd146d Mon Sep 17 00:00:00 2001 From: a_kovalenko Date: Tue, 22 Jun 2010 14:02:31 +0000 Subject: [Patch #3019624] fix "place" command segfault on half-dead app main window. --- ChangeLog | 8 ++++++++ generic/tkPlace.c | 9 +++++---- generic/tkWindow.c | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a5b7b3..c8b4d50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-22 Anton Kovalenko + + * generic/tkPlace.c: [Patch #3019624] modify "place" command, + making it get main window through ClientData (like grid or pack + do), instead of calling Tk_MainWindow(interp). + * generic/tkWindow.c: modify "place" entry in commands[], + turn on passMainWindow flag. + 2010-06-22 Jan Nijtmans * generic/ttk/ttkGenStubs.tcl [Bug #3019363] "make genstubs" failure diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 3586014..62ea86d 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.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: tkPlace.c,v 1.29 2010/01/02 22:52:38 dkf Exp $ + * RCS: @(#) $Id: tkPlace.c,v 1.30 2010/06/22 14:02:32 a_kovalenko Exp $ */ #include "tkInt.h" @@ -205,11 +205,12 @@ static void UnlinkSlave(Slave *slavePtr); int Tk_PlaceObjCmd( - ClientData clientData, /* NULL. */ + ClientData clientData, /* Interpreter main window. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + Tk_Window main_win = clientData; Tk_Window tkwin; Slave *slavePtr; TkDisplay *dispPtr; @@ -237,7 +238,7 @@ Tk_PlaceObjCmd( */ if (Tcl_GetString(objv[1])[0] == '.') { - if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), objv[1], + if (TkGetWindowFromObj(interp, main_win, objv[1], &tkwin) != TCL_OK) { return TCL_ERROR; } @@ -261,7 +262,7 @@ Tk_PlaceObjCmd( * possible additional arguments. */ - if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), objv[2], + if (TkGetWindowFromObj(interp, main_win, objv[2], &tkwin) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkWindow.c b/generic/tkWindow.c index e2f6f61..a47b080 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -11,7 +11,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.112 2010/06/19 16:18:41 jenglish Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.113 2010/06/22 14:02:32 a_kovalenko Exp $ */ #include "tkInt.h" @@ -127,7 +127,7 @@ static const TkCmd commands[] = { {"lower", NULL, Tk_LowerObjCmd, NULL, 1, 1}, {"option", NULL, Tk_OptionObjCmd, NULL, 1, 1}, {"pack", NULL, Tk_PackObjCmd, NULL, 1, 1}, - {"place", NULL, Tk_PlaceObjCmd, NULL, 1, 0}, + {"place", NULL, Tk_PlaceObjCmd, NULL, 1, 1}, {"raise", NULL, Tk_RaiseObjCmd, NULL, 1, 1}, {"selection", NULL, Tk_SelectionObjCmd, NULL, 0, 1}, {"tk", NULL, NULL, TkInitTkCmd, 1, 1}, -- cgit v0.12