From d902e1f7478630fcabc7c73b106f41a72eb7bb44 Mon Sep 17 00:00:00 2001 From: Zachary Hall Date: Wed, 16 Oct 2024 10:07:23 -0700 Subject: [PATCH] Fix not exiting when closed --- dbus.cpp | 8 +++++--- options.hpp | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dbus.cpp b/dbus.cpp index efa0317..4dda7f2 100644 --- a/dbus.cpp +++ b/dbus.cpp @@ -132,6 +132,7 @@ bool MprisAPI::CanEditTracks() { return false; } MprisAPI::~MprisAPI() { + connection.leaveEventLoop(); unregisterAdaptor(); } #endif @@ -142,7 +143,7 @@ DBusAPI::DBusAPI(Playback *playback, bool daemon) } #else DBusAPI::DBusAPI(Playback *playback, sdbus::IConnection &connection, std::string objectPath, bool daemon) - : AdaptorInterfaces(connection, std::move(objectPath)) + : AdaptorInterfaces(connection, std::move(objectPath)) , daemon(daemon) , playback(playback) , connection(connection) @@ -439,7 +440,8 @@ void DBusAPI::PlayStream(const uint32_t &idx) { DBusAPI::~DBusAPI() { #ifdef DBUS_ENABLED threadExitFlag.store(true); - threadFunc.join(); + threadFunc.detach(); + connection.leaveEventLoop(); unregisterAdaptor(); #endif } @@ -616,4 +618,4 @@ DBusAPISender::~DBusAPISender() { ClearHandle(handle); unregisterProxy(); } -#endif \ No newline at end of file +#endif diff --git a/options.hpp b/options.hpp index f7d0043..3aaf53a 100644 --- a/options.hpp +++ b/options.hpp @@ -67,6 +67,8 @@ namespace Looper::Options { } } path = parent_path; + } else { + break; } } save_options(); @@ -124,4 +126,4 @@ namespace Looper::Options { return (option->get()); } } -#define UI_BACKEND() (Looper::Options::get_option("ui.frontend", "imgui")) \ No newline at end of file +#define UI_BACKEND() (Looper::Options::get_option("ui.frontend", "imgui"))