[Spice-devel] gtk_widget_get_window may return NULL

Dietmar Maurer dietmar at proxmox.com
Tue Sep 24 05:53:11 PDT 2013


> 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.
 
> > 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);
> }
> 
> > 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?


More information about the Spice-devel mailing list