After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 682919 - Crash in GTK+-3.x (3.0.x-3.5.12+) on Windows with CJK IME installed
Crash in GTK+-3.x (3.0.x-3.5.12+) on Windows with CJK IME installed
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Input Methods
3.4.x
Other Windows
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-08-29 06:24 UTC by Fan, Chun-wei
Modified: 2013-06-05 19:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Check context_ime->client_window before calling GDK_WINDOW_HWND (1.35 KB, patch)
2012-08-29 06:24 UTC, Fan, Chun-wei
accepted-commit_now Details | Review

Description Fan, Chun-wei 2012-08-29 06:24:40 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!
Comment 1 Cosimo Cecchi 2012-09-03 16:25:57 UTC
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.
Comment 2 Michael Natterer 2013-06-05 19:07:59 UTC
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)
Comment 3 Michael Natterer 2013-06-05 19:08:42 UTC
ARGH yes this is the bug but not the bug i wanted to edit, at least the
bug and the commit message match ;)