summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/platform/unix/qgenericunixservices.cpp11
-rw-r--r--src/gui/platform/unix/qgenericunixservices_p.h4
2 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/platform/unix/qgenericunixservices.cpp b/src/gui/platform/unix/qgenericunixservices.cpp
index bfd2556b1e6..3aa071b8b26 100644
--- a/src/gui/platform/unix/qgenericunixservices.cpp
+++ b/src/gui/platform/unix/qgenericunixservices.cpp
@@ -385,7 +385,8 @@ QGenericUnixServices::QGenericUnixServices()
QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
auto watcher = new QDBusPendingCallWatcher(pendingCall);
- QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher,
+ m_watcherConnection =
+ QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher,
[this](QDBusPendingCallWatcher *watcher) {
watcher->deleteLater();
QDBusPendingReply<QVariant> reply = *watcher;
@@ -396,6 +397,13 @@ QGenericUnixServices::QGenericUnixServices()
#endif
}
+QGenericUnixServices::~QGenericUnixServices()
+{
+#if QT_CONFIG(dbus)
+ QObject::disconnect(m_watcherConnection);
+#endif
+}
+
QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
{
#if QT_CONFIG(dbus)
@@ -534,6 +542,7 @@ bool QGenericUnixServices::openDocument(const QUrl &url)
#else
QGenericUnixServices::QGenericUnixServices() = default;
+QGenericUnixServices::~QGenericUnixServices() = default;
QByteArray QGenericUnixServices::desktopEnvironment() const
{
diff --git a/src/gui/platform/unix/qgenericunixservices_p.h b/src/gui/platform/unix/qgenericunixservices_p.h
index 56e15103f72..8bb49527793 100644
--- a/src/gui/platform/unix/qgenericunixservices_p.h
+++ b/src/gui/platform/unix/qgenericunixservices_p.h
@@ -27,6 +27,7 @@ class Q_GUI_EXPORT QGenericUnixServices : public QPlatformServices
{
public:
QGenericUnixServices();
+ ~QGenericUnixServices();
QByteArray desktopEnvironment() const override;
@@ -41,6 +42,9 @@ public:
private:
QString m_webBrowser;
QString m_documentLauncher;
+#if QT_CONFIG(dbus)
+ QMetaObject::Connection m_watcherConnection;
+#endif
bool m_hasScreenshotPortalWithColorPicking = false;
};