From 4cdfc93526364bc9b20a21c9edd802d737cec85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Tue, 24 Mar 2015 20:08:48 +0100 Subject: gtk: do not call gtk_widget_get_window if drawing area is not initialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents gtk_widget_get_window to return a NULL pointer. Signed-off-by: Hervé Poussineau Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 6a81076ffc..51abac9f47 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -294,6 +294,10 @@ static void gd_update_cursor(VirtualConsole *vc) return; } + if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { + return; + } + window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area)); if (s->full_screen || qemu_input_is_absolute() || s->ptr_owner == vc) { 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); + if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { + return; + } + if (vc->gfx.convert) { pixman_image_composite(PIXMAN_OP_SRC, vc->gfx.ds->image, NULL, vc->gfx.convert, @@ -540,6 +548,10 @@ static void gd_cursor_define(DisplayChangeListener *dcl, GdkPixbuf *pixbuf; GdkCursor *cursor; + if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { + return; + } + pixbuf = gdk_pixbuf_new_from_data((guchar *)(c->data), GDK_COLORSPACE_RGB, true, 8, c->width, c->height, c->width * 4, -- cgit v1.2.3