Commit 6905b934 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Gerd Hoffmann
Browse files

console: add same surface replace pre-condition



Catch an invalid state early, before a potential use-after-free. This is
mainly useful for documentation purposes.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20170406120513.638-2-marcandre.lureau@redhat.com
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 32c7e0ab
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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)) {