diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2012-08-29 14:03:46 +0800 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2012-09-03 16:03:58 -0400 |
commit | a866ed737810ea32ec55260ad512f386a4e6df5d (patch) | |
tree | c3c2798f9b3b6359bba0698b303d3077674f2acd /modules | |
parent | d05191a010bcd9871b0155a785989192967c692b (diff) | |
download | gtk+-a866ed737810ea32ec55260ad512f386a4e6df5d.tar.gz |
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
Diffstat (limited to 'modules')
-rw-r--r-- | modules/input/gtkimcontextime.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/input/gtkimcontextime.c b/modules/input/gtkimcontextime.c index 3dd06506e4..009af3febe 100644 --- a/modules/input/gtkimcontextime.c +++ b/modules/input/gtkimcontextime.c @@ -375,6 +375,8 @@ get_utf8_preedit_string (GtkIMContextIME *context_ime, gint *pos_ret) if (pos_ret) *pos_ret = 0; + if (!context_ime->client_window) + return g_strdup (""); hwnd = GDK_WINDOW_HWND (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) @@ -434,6 +436,8 @@ get_pango_attr_list (GtkIMContextIME *context_ime, const gchar *utf8str) HWND hwnd; HIMC himc; + if (!context_ime->client_window) + return attrs; hwnd = GDK_WINDOW_HWND (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) |