summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-10-24 19:03:03 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-10-24 19:03:03 (GMT)
commitf84f7e53e3c8ba30b1a3861253c44e99a753d77c (patch)
tree4f995399f65af9a43d0364be00632521b8d40e49
parent7d1aace3734e93fd19cd2fa7cb3d0b04cf555c1c (diff)
downloadtk-f84f7e53e3c8ba30b1a3861253c44e99a753d77c.zip
tk-f84f7e53e3c8ba30b1a3861253c44e99a753d77c.tar.gz
tk-f84f7e53e3c8ba30b1a3861253c44e99a753d77c.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.
-rw-r--r--ChangeLog6
-rw-r--r--macosx/tkMacOSXWm.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 18c3d0a..7af182b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-24 Don Porter <dgp@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c: [Bug 3574893] Add overlooked toplevel ref
+ count maintenance in the [wm manage|forget] operations that could
+ cause segfaults due to premature free of structs.
+
2012-10-23 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tkButton.h: Backport of ::tk::mac::useCompatibilityMetrics
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 1f4e2e2..45f0fd5 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1654,7 +1654,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);
@@ -2419,7 +2421,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);
@@ -6536,7 +6540,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;