Fix not exiting when closed

This commit is contained in:
Zachary Hall 2024-10-16 10:07:23 -07:00
parent 63391a3be6
commit d902e1f747
2 changed files with 8 additions and 4 deletions

View file

@ -132,6 +132,7 @@ bool MprisAPI::CanEditTracks() {
return false; return false;
} }
MprisAPI::~MprisAPI() { MprisAPI::~MprisAPI() {
connection.leaveEventLoop();
unregisterAdaptor(); unregisterAdaptor();
} }
#endif #endif
@ -142,7 +143,7 @@ DBusAPI::DBusAPI(Playback *playback, bool daemon)
} }
#else #else
DBusAPI::DBusAPI(Playback *playback, sdbus::IConnection &connection, std::string objectPath, bool daemon) DBusAPI::DBusAPI(Playback *playback, sdbus::IConnection &connection, std::string objectPath, bool daemon)
: AdaptorInterfaces(connection, std::move(objectPath)) : AdaptorInterfaces(connection, std::move(objectPath))
, daemon(daemon) , daemon(daemon)
, playback(playback) , playback(playback)
, connection(connection) , connection(connection)
@ -439,7 +440,8 @@ void DBusAPI::PlayStream(const uint32_t &idx) {
DBusAPI::~DBusAPI() { DBusAPI::~DBusAPI() {
#ifdef DBUS_ENABLED #ifdef DBUS_ENABLED
threadExitFlag.store(true); threadExitFlag.store(true);
threadFunc.join(); threadFunc.detach();
connection.leaveEventLoop();
unregisterAdaptor(); unregisterAdaptor();
#endif #endif
} }
@ -616,4 +618,4 @@ DBusAPISender::~DBusAPISender() {
ClearHandle(handle); ClearHandle(handle);
unregisterProxy(); unregisterProxy();
} }
#endif #endif

View file

@ -67,6 +67,8 @@ namespace Looper::Options {
} }
} }
path = parent_path; path = parent_path;
} else {
break;
} }
} }
save_options(); save_options();
@ -124,4 +126,4 @@ namespace Looper::Options {
return (option->get()); return (option->get());
} }
} }
#define UI_BACKEND() (Looper::Options::get_option<std::string>("ui.frontend", "imgui")) #define UI_BACKEND() (Looper::Options::get_option<std::string>("ui.frontend", "imgui"))