summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfsuit <wolfsuit>2002-02-06 07:02:03 (GMT)
committerwolfsuit <wolfsuit>2002-02-06 07:02:03 (GMT)
commit0bc9c3e5244fd68c5a0170e502a4393a567d7537 (patch)
tree65d710e8c15028844220bd969c512c9eb80cc176
parentbcdb604e358027dd76ac168778b14546a8019d8a (diff)
downloadtk-0bc9c3e5244fd68c5a0170e502a4393a567d7537.zip
tk-0bc9c3e5244fd68c5a0170e502a4393a567d7537.tar.gz
tk-0bc9c3e5244fd68c5a0170e502a4393a567d7537.tar.bz2
Fix bug #513222. We were acting on the menu after the post event without
checking to see whether the menu event had deleted the menu.
-rw-r--r--ChangeLog7
-rw-r--r--mac/tkMacMenu.c14
-rw-r--r--macosx/tkMacOSXMenu.c27
3 files changed, 36 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index f0ff5ac..e9f0d29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-05 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXMenu.c: Fix 513222. We were going to
+ invalidate the menu & delete the selection without checking
+ whether the menu had already been deleted.
+ * mac/tkMacMenu.c: ditto.
+
2002-02-04 Jim Ingham <jingham@apple.com>
* macosx/tkMacOSXWm.c (Tk_WMStackorderToplevel): crab the Mac
diff --git a/mac/tkMacMenu.c b/mac/tkMacMenu.c
index 898057d..4000785 100644
--- a/mac/tkMacMenu.c
+++ b/mac/tkMacMenu.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: tkMacMenu.c,v 1.20.2.1 2002/02/05 02:25:17 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacMenu.c,v 1.20.2.2 2002/02/06 07:02:04 wolfsuit Exp $
*/
#include "tkMacInt.h"
@@ -1405,9 +1405,17 @@ TkpPostMenu(
TkMacHandleTearoffMenu();
result = TCL_OK;
}
- InvalidateMDEFRgns();
- RecursivelyClearActiveMenu(menuPtr);
+ /*
+ * Be careful, here. The command executed in handling the menu event
+ * could destroy the window. Don't try to do anything with it then.
+ */
+
+ if (menuPtr->tkwin) {
+ InvalidateMDEFRgns();
+ RecursivelyClearActiveMenu(menuPtr);
+ }
+
inPostMenu--;
}
return result;
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 713fcba..9cbc803 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.1.2.2 2002/02/05 02:25:17 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.1.2.3 2002/02/06 07:02:04 wolfsuit Exp $
*/
#include "tkMacOSXInt.h"
#include "tkMenuButton.h"
@@ -642,14 +642,16 @@ TkpDestroyMenu(
}
if (menuPtr->platformData != NULL) {
MenuID menuID;
- DeleteMenu(menuID=GetMenuID(macMenuHdl));
- TkMacOSXFreeMenuID(menuID);
- DisposeMenu(macMenuHdl);
- ckfree((char *) menuPtr->platformData);
+ menuID = GetMenuID(macMenuHdl);
+ DeleteMenu(menuID);
+ TkMacOSXFreeMenuID(menuID);
+ DisposeMenu(macMenuHdl);
+ ckfree((char *) menuPtr->platformData);
menuPtr->platformData = NULL;
}
}
-
+
+
/*
*----------------------------------------------------------------------
*
@@ -1363,9 +1365,16 @@ TkpPostMenu(
TkMacOSXHandleTearoffMenu();
result = TCL_OK;
}
- InvalidateMDEFRgns();
- RecursivelyClearActiveMenu(menuPtr);
-
+
+ /*
+ * Be careful, here. The command executed in handling the menu event
+ * could destroy the window. Don't try to do anything with it then.
+ */
+
+ if (menuPtr->tkwin) {
+ InvalidateMDEFRgns();
+ RecursivelyClearActiveMenu(menuPtr);
+ }
inPostMenu--;
}
return result;