diff options
author | dgp <dgp@noemail.net> | 2012-10-24 19:21:41 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2012-10-24 19:21:41 (GMT) |
commit | 75995ca2d57c8ac69495600238bb06dfec4ff0e9 (patch) | |
tree | 76a50d14d8f6d2c5a41b0fbd27b7ea2a17c2b640 | |
parent | fe354d30662d673b423c0648d591cb78cb5ebd4a (diff) | |
parent | 0b5884f85f5a3fea1504f0cb0012f2ebf0d47291 (diff) | |
download | tk-75995ca2d57c8ac69495600238bb06dfec4ff0e9.zip tk-75995ca2d57c8ac69495600238bb06dfec4ff0e9.tar.gz tk-75995ca2d57c8ac69495600238bb06dfec4ff0e9.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.
FossilOrigin-Name: bda8f8dc8600fd52610c1d6beabe0ee485b52347
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 6 |
2 files changed, 12 insertions, 0 deletions
@@ -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-09-19 Jan Nijtmans <nijtmans@users.sf.net> * win/Makefile.in: Compile win32 binaries with -DTCL_NO_DEPRECATED 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; |