GNOME Bugzilla – Bug 682919
Crash in GTK+-3.x (3.0.x-3.5.12+) on Windows with CJK IME installed
Last modified: 2013-06-05 19:08:42 UTC
Created attachment 222715 [details] [review] Check context_ime->client_window before calling GDK_WINDOW_HWND Hi, I was running through the demos and found that the demo program crashes whenever I try to run "Color" and "Font" picker demos, either with the binaries built with Visual C++ or the OBS-provided (MinGW) binaries. After talking to Dieter, I found that this problem occurs on systems with Windows IME installed (but ran fine on Windows without IME installed). Upon investigation with the Visual C++ debugger, it seemed that the crash is triggered by GDK_WINDOW_HWND (context_ime->client_window) calls in modules/input/gtkimcontextime.c, when context_ime->client_window is NULL, in the functions get_pango_attr_list() and get_utf8_preedit_string(). This patch attempts to address the issue by bailing out (in the same manner when the subsequent himc variable is NULL) of these functions when context_ime->client_window is NULL. With blessings, Thank you!
Review of attachment 222715 [details] [review]: Not the best expert on that part of the code, but it looks good to me. ::: modules/input/gtkimcontextime.c @@ +377,3 @@ + if (!context_ime->client_window) + return g_strdup (""); There are similar checks all over the place in the file, so I think the approach is okay.
For the record: commit 2d57ddd6ef0ef44382be7080484e2408375eb463 Author: Chun-wei Fan <fanchunwei@src.gnome.org> Date: Wed Aug 29 14:03:46 2012 +0800 gtkimcontexttime.c: Check context_ime->client_window is not NULL Be a bit more careful in get_pango_attr_list() and get_utf8_preedit_string() to ensure that the client_window is properly created before proceeding, to avoid access violation/segfault crashes on Windows with IME installed, especially when running the pickers demo. https://bugzilla.gnome.org/show_bug.cgi?id=682919 (cherry picked from commit a866ed737810ea32ec55260ad512f386a4e6df5d)
ARGH yes this is the bug but not the bug i wanted to edit, at least the bug and the commit message match ;)