[pim/kleopatra] src: Don't call KWaylandExtras::exportToplevel with nullptr

Ingo Klöcker <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 592e8c40d3a4d03a98223282f0545908c1e70c8f by Ingo Klöcker, on behalf of Ingo Klöcker.
Committed on 06/08/2026 at 13:50.
Pushed by kloecker into branch 'master'.

Don't call KWaylandExtras::exportToplevel with nullptr

On X11 calling KWaylandExtras::exportToplevel with nullptr crashes. So
don't do this. (KWaylandExtras::exportWindow simply ignores nullptr
and so does KWaylandExtras::exportToplevel on Wayland.)

BUG: 523917

M  +6    -10   src/kleopatraapplication.cpp

https://invent.kde.org/pim/kleopatra/-/commit/592e8c40d3a4d03a98223282f0545908c1e70c8f

diff --git a/src/kleopatraapplication.cpp b/src/kleopatraapplication.cpp
index cf5a99fd8..2dd99d14b 100644
--- a/src/kleopatraapplication.cpp
+++ b/src/kleopatraapplication.cpp
@@ -319,17 +319,13 @@ public:
     void exportFocusWindow()
     {
 #ifdef HAVE_WAYLAND
-        // #if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(6, 28, 0)
-        //         KWaylandExtras::exportToplevel(QGuiApplication::focusWindow());
-        // #else
-        QT_WARNING_PUSH
-        QT_WARNING_DISABLE_DEPRECATED
-        // silence the deprecation warning for KWaylandExtras::exportWindow;
-        // using the recommended replacement KWaylandExtras::exportTopLevel causes a crash:
-        // https://bugs.kde.org/show_bug.cgi?id=523917
+#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(6, 28, 0)
+        if (auto w = QGuiApplication::focusWindow()) {
+            KWaylandExtras::exportToplevel(w);
+        }
+#else
         KWaylandExtras::self()->exportWindow(QGuiApplication::focusWindow());
-        QT_WARNING_POP
-        // #endif
+#endif
 #endif
     }
 };
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.