Commit a866ed73 authored by Chun-wei Fan's avatar Chun-wei Fan Committed by Matthias Clasen

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
parent d05191a0
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment