qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 1/1] gtk: do not call gtk_widget_get_window if drawing area is not initialized
Date: Thu, 26 Mar 2015 18:03:12 +0100	[thread overview]
Message-ID: <1427389392-6051-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1427389392-6051-1-git-send-email-kraxel@redhat.com>

From: Hervé Poussineau <hpoussin@reactos.org>

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>
---
 ui/gtk.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 6a81076..51abac9 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.8.3.1

  reply	other threads:[~2015-03-26 17:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 17:03 [Qemu-devel] [PULL for-2.3 0/1] gtk: do not call gtk_widget_get_window if drawing area is not initialized Gerd Hoffmann
2015-03-26 17:03 ` Gerd Hoffmann [this message]
2015-03-26 19:31 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427389392-6051-2-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).