Skip to content

Commit 07ed02a

Browse files
author
Jeremy Whiting
committed
CODA-Q: Cleanup DBus name registration when exiting.
Added a desctructor to DBusService that unregisters the object and service during shutdown. This should fix any issues users may be having with the flatpak leaving the name in use after exit causing the application to not launch afterwards. Signed-off-by: Jeremy Whiting <[email protected]> Change-Id: I6af3a852433d28ccc6fe3b4ebb3b9a0f6a39a579
1 parent 88feaff commit 07ed02a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

qt/DBusService.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ DBusService::DBusService(QObject* parent)
6565
{
6666
}
6767

68+
DBusService::~DBusService()
69+
{
70+
QDBusConnection sessionBus = QDBusConnection::sessionBus();
71+
72+
// Unregister the object first
73+
sessionBus.unregisterObject(OBJECT_PATH);
74+
75+
// Then unregister the service name
76+
sessionBus.unregisterService(SERVICE_NAME);
77+
}
78+
6879
void DBusService::openFiles(const QStringList& files)
6980
{
7081
coda::openFiles(files);

qt/DBusService.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class DBusService : public QObject
2828

2929
public:
3030
explicit DBusService(QObject* parent = nullptr);
31+
~DBusService();
3132

3233
static bool tryForwardToExistingInstance(const QStringList& files, const QString& templateType);
3334
static bool registerService(DBusService* service);

0 commit comments

Comments
 (0)