qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.3 0/1] gtk: fix NULL dereferences
@ 2015-03-24 19:08 Hervé Poussineau
  2015-03-24 19:08 ` [Qemu-devel] [PATCH for-2.3 1/1] gtk: do not call gtk_widget_get_window if drawing area is not initialized Hervé Poussineau
  0 siblings, 1 reply; 2+ messages in thread
From: Hervé Poussineau @ 2015-03-24 19:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hervé Poussineau, Gerd Hoffmann

Hi,

Attached patch fixes some problems I encountered while testing MIPS Magnum emulation.
(qemu-system-mips64el:1399): Gdk-CRITICAL **: IA__gdk_drawable_get_size: assertion `GDK_IS_DRAWABLE (drawable)' failed
(qemu-system-mips64el:1714): Gdk-CRITICAL **: IA__gdk_window_set_cursor: assertion `GDK_IS_WINDOW (window)' failed

Hervé Poussineau (1):
  gtk: do not call gtk_widget_get_window if drawing area is not
    initialized

 ui/gtk.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Qemu-devel] [PATCH for-2.3 1/1] gtk: do not call gtk_widget_get_window if drawing area is not initialized
  2015-03-24 19:08 [Qemu-devel] [PATCH for-2.3 0/1] gtk: fix NULL dereferences Hervé Poussineau
@ 2015-03-24 19:08 ` Hervé Poussineau
  0 siblings, 0 replies; 2+ messages in thread
From: Hervé Poussineau @ 2015-03-24 19:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hervé Poussineau, Gerd Hoffmann

This prevents gtk_widget_get_window to return a NULL pointer.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 ui/gtk.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 29bdc19..d6e01c2 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,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-24 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 19:08 [Qemu-devel] [PATCH for-2.3 0/1] gtk: fix NULL dereferences Hervé Poussineau
2015-03-24 19:08 ` [Qemu-devel] [PATCH for-2.3 1/1] gtk: do not call gtk_widget_get_window if drawing area is not initialized Hervé Poussineau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).