]> git.proxmox.com Git - mirror_qemu.git/commitdiff
console: add same surface replace pre-condition
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 6 Apr 2017 12:05:11 +0000 (14:05 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 24 Apr 2017 08:12:28 +0000 (10:12 +0200)
Catch an invalid state early, before a potential use-after-free. This is
mainly useful for documentation purposes.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20170406120513.638-2-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/console.c

index 419b098c11f50f8ed2842fd9d50b7a3cab2f623f..0cbe5033dd636b480c7239e85377f3f94880730e 100644 (file)
@@ -1538,6 +1538,8 @@ void dpy_gfx_replace_surface(QemuConsole *con,
     DisplaySurface *old_surface = con->surface;
     DisplayChangeListener *dcl;
 
+    assert(old_surface != surface);
+
     con->surface = surface;
     QLIST_FOREACH(dcl, &s->listeners, next) {
         if (con != (dcl->con ? dcl->con : active_console)) {