[Spice-devel] gtk_widget_get_window may return NULL

Marc-André Lureau mlureau at redhat.com
Tue Sep 24 07:00:13 PDT 2013



----- Original Message -----
> > It should only be called in enter or focus events, which I assume shouldn't
> > happen when the widget is not realized.
> 
> it receives a focus event.

Ok, interesting.

>  
> > > So this results is a call to GDK_WINDOW_HWND(NULL), which simply crash
> > > remote-viewer.exe
> > 
> > Ok that macro isn't safe. Why do you check (!display), this would really be
> > a
> > programming bug, more than runtime bug.
> 
> oh, sure - that check can be removed
> 
> > I think we should also keep warning when this happen, since it may result
> > in
> > buggy keyboard behaviour later on. ie, doing this:
> > 
> > {
> >   GdkWindow *win = gtk_widget_get_window(GTK_WIDGET(display));
> >   g_return_if_fail(win != NULL);
> >   win32_window = GDK_WINDOW_HWND(win);
> > }
> > 

Will you update your patch?

> > > I have no idea why this only happens with the binaries I compiled myself.
> > 
> > What version of gtk?
> > 
> > (I haven't tried gtk3 on windows for a long time)
> 
> yes, I use gtk+-3.8.4. Is gtk2 considered more stable on windows?

In general yes, but this may have changed, if more people start using and fixing gtk3 on windows. I am interested to hear your experience :) I suppose you are also compiling virt-viewer?

There are not enough reasons to make gtk3 our default, atm. It will eventually happen.



More information about the Spice-devel mailing list