[gtk/issue-61] Ensure we have a client window before using it



commit 0ade87ef9278b03172a97f66af32f4cb2c73527a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Nov 16 20:57:43 2019 +0000

    Ensure we have a client window before using it
    
    The XIM input method can some times go into weird states, especially
    when extended devices or in mixed environments with multiple input
    methods installed.
    
    Ideally, people should simply stop using XIM, which is utterly broken,
    and use IBus instead; nevertheless, crashing is not nice.
    
    Fixes: #61
    Fixes: #518

 modules/input/gtkimcontextxim.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index 3f1741880d..a181e5ebf8 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -650,6 +650,9 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
   GdkWindow *window;
   XKeyPressedEvent xevent;
 
+  if (context_xim->client_window == NULL)
+    return FALSE;
+
   if (event->type == GDK_KEY_RELEASE && !context_xim->filter_key_release)
     return FALSE;
 
@@ -1344,6 +1347,9 @@ gtk_im_context_xim_get_ic (GtkIMContextXIM *context_xim)
   if (context_xim->im_info == NULL || context_xim->im_info->im == NULL)
     return NULL;
 
+  if (context_xim->client_window == NULL)
+    return NULL;
+
   if (!context_xim->ic)
     {
       const char *name1 = NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]