[spice-gtk][PATCH v3] spice-widget: check whether the widget is realized in focus_in_event()

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

 



Returning early on focus_in_event(), when widget is not realized, avoids
segfault when running on Windows using GTK3.

Program received signal SIGSEGV, Segmentation fault.
_gdk_windows_has_impl <window=window@entry=0x0> at gdkwindow.c:584
<gdb> bt
 #0  _gdk_window_has_impl (window=window@entry=0x0) at gdkwindow.c:584
 #1  0x70f02821 in gdk_win32_window_get_handle (window=0x0) at
     gdkwindow-win32.c:3459
 #2  0x00c759ef in update_display (display=0x1b18440) at
     spice-widget.c:1297
 #3  0x00c77280 in focus_in_event (widget=0x1b18440, focus=0x1b02b68) at
     spice-widget.c:1462
 #4  0x665727f5 in ?? () from C:\Program Files\VirtViewer
     (GTK3)\bin\libgtk-3-0.dll
 #5  0x00000000 in ?? ()
---
 gtk/spice-widget.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index ae11073..87fd462 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1447,6 +1447,9 @@ static gboolean focus_in_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UN
 
     SPICE_DEBUG("%s", __FUNCTION__);
 
+    if (!gtk_widget_get_realized(widget))
+        return true;
+
     /*
      * Ignore focus in when we already have the focus
      * (this happens when doing an ungrab from the leave_event callback).
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]