From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH for-2.3 1/1] gtk: do not call gtk_widget_get_window if drawing area is not initialized
Date: Tue, 24 Mar 2015 20:08:48 +0100 [thread overview]
Message-ID: <1427224128-2004-2-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1427224128-2004-1-git-send-email-hpoussin@reactos.org>
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
prev parent reply other threads:[~2015-03-24 19:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=1427224128-2004-2-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=kraxel@redhat.com \
--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).