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: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20170406120513.638-2-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
32c7e0ab75
commit
6905b93447
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user