Package: tk8.6 Version: 8.6.1-3ubuntu2 Severity: important Tags: upstream patch Forwarded: http://core.tcl.tk/tk/tktview?name=7d967c68a0
Hi, Steve Paik (cc-ed) reported that gitk is crashing periodically. This patch, from upstream tk, should fix it. Thoughts? Please forgive the whitespace damage. Copy/paste was the simplest way to get this here. Thanks, Jonathan commit 0175bc1be685a5ce4a92f7c153eb12e28c28cb1d (origin/bug_7d967c68) Author: jan.nijtmans <nijtm...@users.sourceforge.net> Date: Thu Dec 15 16:07:06 2016 +0000 Proposed fix for [7d967c68a09e07e355358af40f36dd5dd84c7022|7d967c68]: Tk applications segmentation fault when ibus-daemon IME is restarted diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 95aeda1dd..d058e7cd6 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -356,6 +356,7 @@ CreateXIC( /* XCreateIC failed. */ return; } + winPtr->ximGeneration = dispPtr->ximGeneration; /* * Adjust the window's event mask if the IM requires it. @@ -1288,6 +1289,14 @@ Tk_HandleEvent( */ #ifdef TK_USE_INPUT_METHODS + /* + * If the XIC has been invalidated, it must be recreated. + */ + if (winPtr->dispPtr->ximGeneration != winPtr->ximGeneration) { + winPtr->flags &= ~TK_CHECKED_IC; + winPtr->inputContext = NULL; + } + if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) { if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) { winPtr->flags |= TK_CHECKED_IC; @@ -1295,7 +1304,9 @@ Tk_HandleEvent( CreateXIC(winPtr); } } - if (eventPtr->type == FocusIn && winPtr->inputContext != NULL) { + if ((eventPtr->type == FocusIn) && + (winPtr->dispPtr->inputMethod != NULL) && + (winPtr->inputContext != NULL)) { XSetICFocus(winPtr->inputContext); } } commit 596abb7b53897447dda6044725ea94a664dae64e Author: jan.nijtmans <nijtm...@users.sourceforge.net> Date: Fri Feb 10 11:38:55 2017 +0000 Fix [7d967c68a09e07e355358af40f36dd5dd84c7022|7d967c68a0] follow-up: Tk applications segmentation fault when ibus-daemon IME is restarted. Patch by Brad Lanam. diff --git a/generic/tkWindow.c b/generic/tkWindow.c index e4d696bdd..690a8412d 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -475,9 +475,6 @@ GetScreen( dispPtr->cursorFont = None; dispPtr->warpWindow = NULL; dispPtr->multipleAtom = None; -#ifdef TK_USE_INPUT_METHODS - dispPtr->ximGeneration = 0; -#endif /*TK_USE_INPUT_METHODS*/ /* * By default we do want to collapse motion events in @@ -656,6 +653,7 @@ TkAllocWindow( winPtr->flags = 0; winPtr->handlerList = NULL; #ifdef TK_USE_INPUT_METHODS + winPtr->ximGeneration = 0; winPtr->inputContext = NULL; #endif /* TK_USE_INPUT_METHODS */ winPtr->tagPtr = NULL;