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.
This commit is contained in:

committed by
Matthias Clasen

parent
b3ff8bbe31
commit
4ba1fbfdb1
@ -195,11 +195,7 @@ quartz_filter_keypress (GtkIMContext *context,
|
||||
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));
|
||||
|
||||
@ -251,9 +247,6 @@ discard_preedit (GtkIMContext *context)
|
||||
if (!nsview)
|
||||
return;
|
||||
|
||||
if (GDK_IS_WINDOW (nsview))
|
||||
return;
|
||||
|
||||
/* reset any partial input for this NSView */
|
||||
[(GdkQuartzView *)nsview unmarkText];
|
||||
NSInputManager *currentInputManager = [NSInputManager currentInputManager];
|
||||
@ -334,9 +327,6 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
|
||||
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 */
|
||||
return;
|
||||
|
||||
win = (GdkWindow *)[ (GdkQuartzView*)nsview gdkWindow];
|
||||
g_object_set_data (G_OBJECT (win), GIC_CURSOR_RECT, qc->cursor_rect);
|
||||
|
Reference in New Issue
Block a user