gtk: do not call gtk_widget_get_window if drawing area is not initialized

This prevents gtk_widget_get_window to return a NULL pointer.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Hervé Poussineau 2015-03-24 20:08:48 +01:00 committed by Gerd Hoffmann
parent 054903a832
commit 4cdfc93526

View File

@ -294,6 +294,10 @@ static void gd_update_cursor(VirtualConsole *vc)
return; return;
} }
if (!gtk_widget_get_realized(vc->gfx.drawing_area)) {
return;
}
window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area)); window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area));
if (s->full_screen || qemu_input_is_absolute() || s->ptr_owner == vc) { if (s->full_screen || qemu_input_is_absolute() || s->ptr_owner == vc) {
gdk_window_set_cursor(window, s->null_cursor); gdk_window_set_cursor(window, s->null_cursor);
@ -458,6 +462,10 @@ static void gd_update(DisplayChangeListener *dcl,
trace_gd_update(vc->label, x, y, w, h); trace_gd_update(vc->label, x, y, w, h);
if (!gtk_widget_get_realized(vc->gfx.drawing_area)) {
return;
}
if (vc->gfx.convert) { if (vc->gfx.convert) {
pixman_image_composite(PIXMAN_OP_SRC, vc->gfx.ds->image, pixman_image_composite(PIXMAN_OP_SRC, vc->gfx.ds->image,
NULL, vc->gfx.convert, NULL, vc->gfx.convert,
@ -540,6 +548,10 @@ static void gd_cursor_define(DisplayChangeListener *dcl,
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
GdkCursor *cursor; GdkCursor *cursor;
if (!gtk_widget_get_realized(vc->gfx.drawing_area)) {
return;
}
pixbuf = gdk_pixbuf_new_from_data((guchar *)(c->data), pixbuf = gdk_pixbuf_new_from_data((guchar *)(c->data),
GDK_COLORSPACE_RGB, true, 8, GDK_COLORSPACE_RGB, true, 8,
c->width, c->height, c->width * 4, c->width, c->height, c->width * 4,