]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Force dbus introspection on the Dolphin_1 object
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 24 Nov 2019 18:18:41 +0000 (19:18 +0100)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Thu, 28 Nov 2019 20:52:16 +0000 (21:52 +0100)
Summary:
QtDBus caches known interfaces when passing a non-empty interface name
to the QDbusInterface constructor. This is an issue when calling the
FileManager1 methods more than once, because `preferred` could be a
valid interface from the cache, but it would later fail to call the
`openFiles`/`openDirectories` methods on the main window.

By passing an empty interface name, we prevent QtDBus from using the
cache so that we always get an invalid interface when calling the
FileManager1 methods on a daemonized dolphin process (that doesn't have
the Dolphin_1 dbus object).

BUG: 414402
FIXED-IN: 19.12.0

Test Plan:
1. dolphin --daemon
2. qdbus org.freedesktop.FileManager1 /org/freedesktop/FileManager1 ShowFolders "/tmp" ""
3. Close the dolphin window that was just opened.
4. Start a normal dolphin process
5. qdbus org.freedesktop.FileManager1 /org/freedesktop/FileManager1 ShowFolders "/tmp" ""
6. Close again the dolphin window
7. qdbus org.freedesktop.FileManager1 /org/freedesktop/FileManager1 ShowFolders "/tmp" ""

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25510

src/global.cpp

index 48e78e9eadec06eec42fd9daea27617c09df2652..3b81c536aea0613a2363a43aecb731d2bd652610 100644 (file)
@@ -82,7 +82,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
         QSharedPointer<QDBusInterface> preferred(
             new QDBusInterface(preferredService,
             QStringLiteral("/dolphin/Dolphin_1"),
-            QStringLiteral("org.kde.dolphin.MainWindow"))
+            QString()) // #414402: use empty interface name to prevent QtDBus from caching the interface.
         );
         if (preferred->isValid() && !preferred->lastError().isValid()) {
             dolphinServices.append(qMakePair(preferred, QStringList()));