From e5e5e796f7b66616934ad8a777732c349d678249 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Mon, 19 Sep 2016 16:25:00 +0200 Subject: [PATCH] Reduce risk of window init interference when floating dock widgets on XCB platforms On XCB platforms, the initialization of native windows is an async task. When floating a dock widget, a new top level window is created, followed by further customizations (changes to title and status bar, child rearrangements etc). The customizations might be triggered at a time when Qt was still processing XCB events and the QWindows state not yet fully initialized. In some random cases, this caused the Window to be invisible. By sleeping for 100 ms on XCB platforms, we make sure that all customizations are delayed long enough that the XCB event thread can continue to process. By then all XCB communication should be finished and the window setup complete. refs #754 --- src/blackgui/dockwidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/blackgui/dockwidget.cpp b/src/blackgui/dockwidget.cpp index 2a375f16d..a0af8cde9 100644 --- a/src/blackgui/dockwidget.cpp +++ b/src/blackgui/dockwidget.cpp @@ -386,6 +386,11 @@ namespace BlackGui void CDockWidget::ps_onTopLevelChanged(bool topLevel) { + #ifdef Q_OS_LINUX + // Give XCB platforms enough time to handle window events before adjusting it. + QThread::msleep(100); + #endif + this->setMargins(); if (topLevel) {