diff options
author | mdejong <mdejong> | 2002-06-19 19:37:53 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2002-06-19 19:37:53 (GMT) |
commit | dff255d271da684e14bdb5d8adc2b9a049296366 (patch) | |
tree | 51116998e0729d291598a2a00efead102da3cb97 /unix | |
parent | d559f300fda548a71eb2a884634384f66e496f31 (diff) | |
download | tk-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 'unix')
-rw-r--r-- | unix/tkUnixEvent.c | 19 | ||||
-rw-r--r-- | unix/tkUnixSend.c | 23 |
2 files changed, 13 insertions, 29 deletions
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 98132a1..918d66a 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.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: tkUnixEvent.c,v 1.8 2002/06/15 01:54:09 hobbs Exp $ + * RCS: @(#) $Id: tkUnixEvent.c,v 1.9 2002/06/19 19:37:55 mdejong Exp $ */ #include "tkInt.h" @@ -172,24 +172,23 @@ TkpCloseDisplay(dispPtr) XFreeFontSet(dispPtr->display, dispPtr->inputXfs); } #endif -#if ! defined(SOLARIS2) || defined(HAVE_X11R6) if (dispPtr->inputMethod) { /* - * This causes core dumps on some systems (e.g. Solaris 2.3 as of - * 1/6/95), but is OK with X11R6 + * This caused core dumps on some systems (Solaris 2.3 1/6/95). + * The most likely cause of this is a bug in X that accesses + * memory that was already deallocated inside XCloseIM(). + * One can work around this issue by making sure a XDestroyIC() + * gets invoked for each XCreateIC(). */ XCloseIM(dispPtr->inputMethod); } #endif -#endif if (dispPtr->display != 0) { Tcl_DeleteFileHandler(ConnectionNumber(dispPtr->display)); (void) XSync(dispPtr->display, False); (void) XCloseDisplay(dispPtr->display); } - - ckfree((char *) dispPtr); } /* @@ -610,12 +609,10 @@ OpenIM(dispPtr) if (dispPtr->inputMethod) { /* - * This causes core dumps on some systems (e.g. Solaris 2.3 as of - * 1/6/95), but is OK with X11R6 + * This call should not suffer from any core dumping problems + * since we have not allocated any input contexts. */ -#if ! defined (SOLARIS2) || defined (HAVE_X11R6) XCloseIM(dispPtr->inputMethod); -#endif dispPtr->inputMethod = NULL; } } diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 843360a..ea0d393 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixSend.c,v 1.7 2002/06/17 19:42:11 hobbs Exp $ + * RCS: @(#) $Id: tkUnixSend.c,v 1.8 2002/06/19 19:37:55 mdejong Exp $ */ #include "tkPort.h" @@ -1275,25 +1275,11 @@ void TkSendCleanup(dispPtr) TkDisplay *dispPtr; { - TkWindow *winPtr = (TkWindow *) dispPtr->commTkwin; - if (dispPtr->commTkwin != NULL) { - Tk_DeleteEventHandler((Tk_Window) winPtr, PropertyChangeMask, + Tk_DeleteEventHandler(dispPtr->commTkwin, PropertyChangeMask, SendEventProc, (ClientData) dispPtr); - - /* - * We need to manually free all the XIC structures that - * have been allocated in order to avoid a nasty bug in XCloseIM(). - */ - if (winPtr->inputContext != NULL) { - XDestroyIC(winPtr->inputContext); - winPtr->inputContext = NULL; - } - -#ifdef PURIFY - /* Tk_DestroyWindow(dispPtr->commTkwin); */ - ckfree((char *) dispPtr->commTkwin); -#endif + Tk_DestroyWindow(dispPtr->commTkwin); + Tcl_Release((ClientData) dispPtr->commTkwin); dispPtr->commTkwin = NULL; } } @@ -1335,6 +1321,7 @@ SendInit(interp, dispPtr) if (dispPtr->commTkwin == NULL) { panic("Tk_CreateWindow failed in SendInit!"); } + Tcl_Preserve((ClientData) dispPtr->commTkwin); atts.override_redirect = True; Tk_ChangeWindowAttributes(dispPtr->commTkwin, CWOverrideRedirect, &atts); |