summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2012-10-24 19:21:41 (GMT)
committerdgp@users.sourceforge.net <dgp>2012-10-24 19:21:41 (GMT)
commit377187a4beb12ea6ca59d2531a6934fc8fcc32f7 (patch)
tree76a50d14d8f6d2c5a41b0fbd27b7ea2a17c2b640 /macosx
parent37dbd7ff362e873d8ecaa8321fdffda02d448683 (diff)
parent8a9f0d89b57e0250270dff8f6b27ed69d7dfccfb (diff)
downloadtk-377187a4beb12ea6ca59d2531a6934fc8fcc32f7.zip
tk-377187a4beb12ea6ca59d2531a6934fc8fcc32f7.tar.gz
tk-377187a4beb12ea6ca59d2531a6934fc8fcc32f7.tar.bz2
3574893 Add overlooked toplevel ref count maintenance in the [wm manage|forget]
operations that could cause segfaults due to premature free of structs.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXWm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 1bf6d2c..68cbb00 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1659,7 +1659,9 @@ WmForgetCmd(
TkFocusJoin(winPtr);
Tk_UnmapWindow(frameWin);
+ macWin->toplevel->referenceCount--;
macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
+ macWin->toplevel->referenceCount++;
macWin->flags &= ~TK_HOST_EXISTS;
TkWmDeadWindow(winPtr);
@@ -2448,7 +2450,9 @@ WmManageCmd(
}
wmPtr = winPtr->wmInfoPtr;
winPtr->flags &= ~TK_MAPPED;
+ macWin->toplevel->referenceCount--;
macWin->toplevel = macWin;
+ macWin->toplevel->referenceCount++;
RemapWindows(winPtr, macWin);
winPtr->flags |=
(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
@@ -6599,7 +6603,9 @@ RemapWindows(
if (winPtr->window != None) {
MacDrawable *macWin = (MacDrawable *) winPtr->window;
+ macWin->toplevel->referenceCount--;
macWin->toplevel = parentWin->toplevel;
+ macWin->toplevel->referenceCount++;
winPtr->flags &= ~TK_MAPPED;
#ifdef TK_REBUILD_TOPLEVEL
winPtr->flags |= TK_REBUILD_TOPLEVEL;