summaryrefslogtreecommitdiffstats
path: root/generic/tkClipboard.c
diff options
context:
space:
mode:
authormdejong <mdejong>2002-06-19 19:37:53 (GMT)
committermdejong <mdejong>2002-06-19 19:37:53 (GMT)
commitdff255d271da684e14bdb5d8adc2b9a049296366 (patch)
tree51116998e0729d291598a2a00efead102da3cb97 /generic/tkClipboard.c
parentd559f300fda548a71eb2a884634384f66e496f31 (diff)
downloadtk-dff255d271da684e14bdb5d8adc2b9a049296366.zip
tk-dff255d271da684e14bdb5d8adc2b9a049296366.tar.gz
tk-dff255d271da684e14bdb5d8adc2b9a049296366.tar.bz2
* generic/tkBind.c (TkBindDeadWindow):
Handle case where Tk_DestroyWindow is invoked on clipboard and send windows. * generic/tkClipboard.c (TkClipCleanup): Invoke Tk_DestroyWindow to cleanup the dispPtr->clipWindow. Call Tcl_Preserve and Tcl_Release on the window to avoid an invalid memory ref on shutdown. * generic/tkEvent.c (Tk_HandleEvent): Panic if XCreateIC is invoked twice for the same window. This should never happen, the check were just added to make sure it does not since this could lead to crashes in XCloseIM. * generic/tkFocus.c (TkFocusDeadWindow): Handle case where Tk_DestroyWindow is invoked on clipboard and send windows. * generic/tkOption.c (TkOptionDeadWindow): Ditto. * generic/tkWindow.c (TkCloseDisplay): Move deletion of dispPtr->winTable after TkpCloseDisplay call since Tk_DestroyWindow uses it and could be called by TkpCloseDisplay for clipboard/send windows. Also invoke ckfree for the dispPtr instead of doing it in TkpCloseDisplay. (Tk_DestroyWindow): Check for a null winPtr->mainPtr before doing certain cleanup tasks so the we can invoke Tk_DestroyWindow on clipboard and send windows. We need to do this so that XDestroyIC will get invoked for the input contexts of each window. * mac/tkMacXStubs.c (TkpCloseDisplay): Don't free the displayPtr since this is now done in TkCloseDisplay. * unix/tkUnixEvent.c (TkpCloseDisplay, OpenIM): Remove conditional compilation around calls to XCloseIM since I am confident that the crashes related to input contexts has been fixed. Don't free the displayPtr since this is now done in TkCloseDisplay. * unix/tkUnixSend.c (TkSendCleanup): Invoke the Tk_DestroyWindow method to cleanup the special send window. This will call XDestroyIC and thereby avoid a crash in XCloseIM. The send window needs to be Tcl_Preserve and Tcl_Release to avoid an invalid memory ref on shutdown. * win/tkWinX.c (TkpCloseDisplay): Don't free the displayPtr since this is now done in TkCloseDisplay.
Diffstat (limited to 'generic/tkClipboard.c')
-rw-r--r--generic/tkClipboard.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 149f65d..c43d621 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.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: tkClipboard.c,v 1.9 2002/04/12 10:03:02 hobbs Exp $
+ * RCS: @(#) $Id: tkClipboard.c,v 1.10 2002/06/19 19:37:54 mdejong Exp $
*/
#include "tkInt.h"
@@ -649,12 +649,9 @@ TkClipCleanup(dispPtr)
dispPtr->applicationAtom);
Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
dispPtr->windowAtom);
- /*
- * It may be too late to call Tk_DestroyWindow, so just free the
- * memory created directly.
- */
- ckfree((char *) dispPtr->clipWindow);
- dispPtr->clipWindow = NULL;
+
+ Tk_DestroyWindow(dispPtr->clipWindow);
+ Tcl_Release((ClientData) dispPtr->clipWindow);
}
}
@@ -700,6 +697,7 @@ TkClipInit(interp, dispPtr)
if (dispPtr->clipWindow == NULL) {
return TCL_ERROR;
}
+ Tcl_Preserve((ClientData) dispPtr->clipWindow);
atts.override_redirect = True;
Tk_ChangeWindowAttributes(dispPtr->clipWindow, CWOverrideRedirect, &atts);
Tk_MakeWindowExist(dispPtr->clipWindow);