1 From 4ba1fbfdb15fdf31643b7c88ca457b0eb71a0c00 Mon Sep 17 00:00:00 2001
2 From: David Lechner <david@lechnology.com>
3 Date: Fri, 2 Oct 2015 13:45:00 +0000
4 Subject: [PATCH] Bug 753992 - im-quartz discard_preedit segmentation fault
6 Replace checking if the NSView is really a GdkWindow, which will crash
7 in the likely event it's not a GObject, with ensuring that the parent
8 GdkWindow is really a GdkWindowQuartz.
10 modules/input/imquartz.c | 12 +-----------
11 1 file changed, 1 insertion(+), 11 deletions(-)
13 diff --git a/modules/input/imquartz.c b/modules/input/imquartz.c
14 index 67c7d6c..f6d8f0f 100644
15 --- a/modules/input/imquartz.c
16 +++ b/modules/input/imquartz.c
17 @@ -195,11 +195,7 @@ quartz_filter_keypress (GtkIMContext *context,
20 nsview = gdk_quartz_window_get_nsview (qc->client_window);
21 - if (GDK_IS_WINDOW (nsview))
22 - /* it gets GDK_WINDOW in some cases */
23 - return gtk_im_context_filter_keypress (qc->slave, event);
25 - win = (GdkWindow *)[ (GdkQuartzView *)nsview gdkWindow];
26 + win = (GdkWindow *)[ (GdkQuartzView *)nsview gdkWindow];
27 GTK_NOTE (MISC, g_print ("client_window: %p, win: %p, nsview: %p\n",
28 qc->client_window, win, nsview));
30 @@ -251,9 +247,6 @@ discard_preedit (GtkIMContext *context)
34 - if (GDK_IS_WINDOW (nsview))
37 /* reset any partial input for this NSView */
38 [(GdkQuartzView *)nsview unmarkText];
39 NSInputManager *currentInputManager = [NSInputManager currentInputManager];
40 @@ -334,9 +327,6 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
41 qc->cursor_rect->y = area->y + y;
43 nsview = gdk_quartz_window_get_nsview (qc->client_window);
44 - if (GDK_IS_WINDOW (nsview))
45 - /* it returns GDK_WINDOW in some cases */
48 win = (GdkWindow *)[ (GdkQuartzView*)nsview gdkWindow];
49 g_object_set_data (G_OBJECT (win), GIC_CURSOR_RECT, qc->cursor_rect);