[graphics/digikam] core/libs/widgets/layout: Do not show the thumbbar dock before it is attached to a window

Gilles Caulier <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit edd0a5bd5bb5408a0bf30054ad300333268a559a by Gilles Caulier, on behalf of Mikhail Hrechyn.
Committed on 03/08/2026 at 02:19.
Pushed by cgilles into branch 'master'.

Do not show the thumbbar dock before it is attached to a window

SurveyStack creates its ThumbBarDock without a parent and only hands it
to the survey window later, in SurveyStack::setDockArea(). The stack
constructor ends with setViewMode(PreviewImageMode), which calls
ThumbBarDock::restoreVisibility(), and since the freshly constructed
dock still defaults to SHOULD_BE_SHOWN, the parentless dock is made
visible. Qt therefore maps it as a real top-level window for the few
microseconds until setDockArea() reparents it. The user configuration
does not matter here, readSettings() and setShouldBeVisible() only run
after the stack has been built.

On Wayland this stray toplevel is not just an invisible flicker. Qt
requests window activation for the windows it shows, so the
compositor hands out an xdg-activation token for a surface that is
destroyed before the token arrives, and the token is never used. On
GNOME every committed token is a startup sequence, and an incomplete
sequence keeps the busy cursor spinning over the whole desktop until
mutter times the sequence out after 15 seconds. digiKam is fully
usable during that time, which makes it look like the application
hangs right after startup.

Bail out of restoreVisibility() while the dock has no parent widget
and leave the pending visibility state alone. The owning window calls
restoreVisibility() again from its show event, so the thumbbar still
comes up exactly as configured.

Reported downstream at
https://github.com/flathub/org.kde.digikam/issues/319

M  +10   -0    core/libs/widgets/layout/thumbbardock.cpp

https://invent.kde.org/graphics/digikam/-/commit/edd0a5bd5bb5408a0bf30054ad300333268a559a

diff --git a/core/libs/widgets/layout/thumbbardock.cpp b/core/libs/widgets/layout/thumbbardock.cpp
index 12ec526865..7fd760e745 100644
--- a/core/libs/widgets/layout/thumbbardock.cpp
+++ b/core/libs/widgets/layout/thumbbardock.cpp
@@ -194,6 +194,16 @@ QAction* ThumbBarDock::getToggleAction(QObject* const parent, const QString& cap
 
 void ThumbBarDock::restoreVisibility()
 {
+    // As long as the dock has not been attached to a QMainWindow it is a
+    // top-level widget on its own and showing it would map a stray window.
+    // The pending state is left untouched, the owning window calls this
+    // method again from its show event.
+
+    if (!parentWidget())
+    {
+        return;
+    }
+
     // Set the visibility to what it should be or to what it was. Reset
     // SHOULD_BE_ values to their WAS_ values, to implement correct behavior
     // on subsequent calls.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.