From 5a68b8b39da89e2d2590fefa5e02a774480bf887 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 27 Apr 2021 03:43:45 +0200 Subject: [PATCH] Flush the reparent from 0c7dbe8 This should add a root reparent to prevent that X11 error, but it should still prevent flickering by doing it just before closing the window. --- src/wine-host/editor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 4b97c31a..91f8307c 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -147,12 +147,18 @@ DeferredWindow::~DeferredWindow() { // Note that we capture a copy of `destroy_timer` here. This way we don't // have to manage the timer instance ourselves as it will just clean itself // up after this lambda gets called. - destroy_timer->async_wait([destroy_timer, handle = this->handle]( + destroy_timer->async_wait([destroy_timer, handle = this->handle, + x11_connection = this->x11_connection]( const boost::system::error_code& error) { if (error.failed()) { return; } + // This is the flush for the reparent done above. We'll also do this as + // late as possible to prevent the window from being drawn in the + // meantime, as that would cause flickering. + xcb_flush(x11_connection.get()); + // The actual destroying will happen as part of the Win32 message loop PostMessage(handle, WM_CLOSE, 0, 0); });