[Spice-devel] gtk_widget_get_window may return NULL

Dietmar Maurer dietmar at proxmox.com
Tue Sep 24 05:16:35 PDT 2013


I try to cross compile virt-viewer to win32 using Debian Jessie. So far it works,
but only if I apply the following patch to spice-widget.c:

Index: new/gtk/spice-widget.c
===================================================================
--- new.orig/gtk/spice-widget.c	2013-06-26 15:55:08.000000000 +0200
+++ new/gtk/spice-widget.c	2013-09-24 12:00:17.889780000 +0200
@@ -1286,7 +1286,12 @@
 static void update_display(SpiceDisplay *display)
 {
 #ifdef WIN32
-    win32_window = display ? GDK_WINDOW_HWND(gtk_widget_get_window(GTK_WIDGET(display))) : NULL;
+    if (!display)
+        return;
+
+    GdkWindow *win = gtk_widget_get_window(GTK_WIDGET(display));
+
+    win32_window = win ? GDK_WINDOW_HWND(win) : NULL;
 #endif
 }

Seems that update_display() is called early on startup when the window is not realized. 
So this results is a call to GDK_WINDOW_HWND(NULL), which simply crash remote-viewer.exe

I have no idea why this only happens with the binaries I compiled myself.

And ideas?



More information about the Spice-devel mailing list