From: Marc-André Lureau <marcandre.lur...@redhat.com> Track multiple callers blocking requests.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- ui/console.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/console.c b/ui/console.c index 3c4012271c..8d641b9530 100644 --- a/ui/console.c +++ b/ui/console.c @@ -128,7 +128,7 @@ struct QemuConsole { DisplaySurface *surface; int dcls; DisplayChangeListener *gl; - bool gl_block; + int gl_block; int window_id; /* Graphic console state. */ @@ -288,10 +288,19 @@ void graphic_hw_gl_block(QemuConsole *con, bool block) { assert(con != NULL); - con->gl_block = block; - if (con->hw_ops->gl_block) { - con->hw_ops->gl_block(con->hw, block); + if (block) { + con->gl_block++; + } else { + con->gl_block--; + } + assert(con->gl_block >= 0); + if (!con->hw_ops->gl_block) { + return; + } + if ((block && con->gl_block != 1) || (!block && con->gl_block != 0)) { + return; } + con->hw_ops->gl_block(con->hw, block); } void graphic_hw_gl_flushed(QemuConsole *con) -- 2.33.0.721.g106298f7f9