[gtk+/gtk-3-18] Bug 753992 - im-quartz discard_preedit segmentation fault



commit 4cdec89bc47b9de4d102ccc1f4beba1d7ecc5203
Author: John Ralls <jralls ceridwen us>
Date:   Fri Sep 18 15:12:24 2015 -0700

    Bug 753992 - im-quartz discard_preedit segmentation fault
    
    Replace checking if the NSView is really a GdkWindow, which will crash
    in the likely event it's not a GObject, with ensuring that the parent
    GdkWindow is really a GdkWindowQuartz.
    
    (cherry picked from commit 571704824f78de9d8b262793397a4e4ea6cedf7d)

 modules/input/imquartz.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/modules/input/imquartz.c b/modules/input/imquartz.c
index 5db6481..508ecf8 100644
--- a/modules/input/imquartz.c
+++ b/modules/input/imquartz.c
@@ -186,15 +186,11 @@ quartz_filter_keypress (GtkIMContext *context,
 
   GTK_NOTE (MISC, g_print ("quartz_filter_keypress\n"));
 
-  if (!qc->client_window)
+  if (!GDK_IS_QUARTZ_WINDOW (qc->client_window))
     return FALSE;
 
   nsview = gdk_quartz_window_get_nsview (qc->client_window);
-  if (GDK_IS_WINDOW (nsview))
-       /* it gets GDK_WINDOW in some cases */
-    return gtk_im_context_filter_keypress (qc->slave, event);
-  else
-    win = (GdkWindow *)[ (GdkQuartzView *)nsview gdkWindow];
+  win = (GdkWindow *)[ (GdkQuartzView *)nsview gdkWindow];
   GTK_NOTE (MISC, g_print ("client_window: %p, win: %p, nsview: %p\n",
                           qc->client_window, win, nsview));
 
@@ -242,11 +238,11 @@ discard_preedit (GtkIMContext *context)
   if (!qc->client_window)
     return;
 
-  NSView *nsview = gdk_quartz_window_get_nsview (qc->client_window);
-  if (!nsview)
+  if (!GDK_IS_QUARTZ_WINDOW (qc->client_window))
     return;
 
-  if (GDK_IS_WINDOW (nsview))
+  NSView *nsview = gdk_quartz_window_get_nsview (qc->client_window);
+  if (!nsview)
     return;
 
   /* reset any partial input for this NSView */
@@ -328,11 +324,10 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
   qc->cursor_rect->x = area->x + x;
   qc->cursor_rect->y = area->y + y;
 
-  nsview = gdk_quartz_window_get_nsview (qc->client_window);
-  if (GDK_IS_WINDOW (nsview))
-    /* it returns GDK_WINDOW in some cases */
+  if (!GDK_IS_QUARTZ_WINDOW (qc->client_window))
     return;
 
+  nsview = gdk_quartz_window_get_nsview (qc->client_window);
   win = (GdkWindow *)[ (GdkQuartzView*)nsview gdkWindow];
   g_object_set_data (G_OBJECT (win), GIC_CURSOR_RECT, qc->cursor_rect);
 }


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