From a984d974f6b3123815d8116428afe8e51e025f31 Mon Sep 17 00:00:00 2001 From: hobbs Date: Mon, 17 Jun 2002 19:42:11 +0000 Subject: * unix/tkUnixSend.c (TkSendCleanup): special cleanup of inputContext to avoid bug in XCloseIM. (dejong) --- unix/tkUnixSend.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 4962e71..843360a 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.6 2002/04/12 10:19:49 hobbs Exp $ + * RCS: @(#) $Id: tkUnixSend.c,v 1.7 2002/06/17 19:42:11 hobbs Exp $ */ #include "tkPort.h" @@ -1275,9 +1275,21 @@ void TkSendCleanup(dispPtr) TkDisplay *dispPtr; { + TkWindow *winPtr = (TkWindow *) dispPtr->commTkwin; + if (dispPtr->commTkwin != NULL) { - Tk_DeleteEventHandler(dispPtr->commTkwin, PropertyChangeMask, - SendEventProc, (ClientData) dispPtr); + Tk_DeleteEventHandler((Tk_Window) winPtr, 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); -- cgit v0.12