From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 1/5] gtk: handle switch_surface(NULL) properly
Date: Mon, 27 Apr 2015 15:39:04 +0200 [thread overview]
Message-ID: <1430141948-18272-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1430141948-18272-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 51abac9..bcbf51a 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -363,6 +363,9 @@ static void gd_update_geometry_hints(VirtualConsole *vc)
GtkWindow *geo_window;
if (vc->type == GD_VC_GFX) {
+ if (!vc->gfx.ds) {
+ return;
+ }
if (s->free_scale) {
geo.min_width = surface_width(vc->gfx.ds) * VC_SCALE_MIN;
geo.min_height = surface_height(vc->gfx.ds) * VC_SCALE_MIN;
@@ -574,22 +577,28 @@ static void gd_switch(DisplayChangeListener *dcl,
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
bool resized = true;
- trace_gd_switch(vc->label, surface_width(surface), surface_height(surface));
+ trace_gd_switch(vc->label,
+ surface ? surface_width(surface) : 0,
+ surface ? surface_height(surface) : 0);
if (vc->gfx.surface) {
cairo_surface_destroy(vc->gfx.surface);
+ vc->gfx.surface = NULL;
+ }
+ if (vc->gfx.convert) {
+ pixman_image_unref(vc->gfx.convert);
+ vc->gfx.convert = NULL;
}
- if (vc->gfx.ds &&
+ if (vc->gfx.ds && surface &&
surface_width(vc->gfx.ds) == surface_width(surface) &&
surface_height(vc->gfx.ds) == surface_height(surface)) {
resized = false;
}
vc->gfx.ds = surface;
- if (vc->gfx.convert) {
- pixman_image_unref(vc->gfx.convert);
- vc->gfx.convert = NULL;
+ if (!surface) {
+ return;
}
if (surface->format == PIXMAN_x8r8g8b8) {
@@ -690,6 +699,9 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
if (!gtk_widget_get_realized(widget)) {
return FALSE;
}
+ if (!vc->gfx.ds) {
+ return FALSE;
+ }
fbw = surface_width(vc->gfx.ds);
fbh = surface_height(vc->gfx.ds);
@@ -771,6 +783,10 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
int fbh, fbw;
int ww, wh;
+ if (!vc->gfx.ds) {
+ return TRUE;
+ }
+
fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x;
fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y;
--
1.8.3.1
next prev parent reply other threads:[~2015-04-27 13:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-27 13:39 [Qemu-devel] [PULL 0/5] gtk patch queue Gerd Hoffmann
2015-04-27 13:39 ` Gerd Hoffmann [this message]
2015-04-27 13:39 ` [Qemu-devel] [PULL 2/5] gtk: bind to text terminal consoles too Gerd Hoffmann
2015-04-27 13:39 ` [Qemu-devel] [PULL 3/5] console/gtk: add qemu_console_get_label Gerd Hoffmann
2015-04-27 13:39 ` [Qemu-devel] [PULL 4/5] gtk: Fix VTE focus grabbing Gerd Hoffmann
2015-04-27 13:39 ` [Qemu-devel] [PULL 5/5] gtk: Avoid accel key leakage into guest on console switch Gerd Hoffmann
2015-04-27 19:00 ` [Qemu-devel] [PULL 0/5] gtk patch queue 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=1430141948-18272-2-git-send-email-kraxel@redhat.com \
--to=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).