2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 15:15:13 +00:00

Use gsl::finally in PortalAutostart

This commit is contained in:
Ilya Fedin
2021-03-07 02:29:38 +04:00
committed by John Preston
parent b918170464
commit 67eba93e29

View File

@@ -172,6 +172,12 @@ PortalAutostart::PortalAutostart(bool start, bool silent) {
"Response",
requestPath);
const auto signalGuard = gsl::finally([&] {
if (signalId != 0) {
connection->signal_unsubscribe(signalId);
}
});
connection->call_sync(
std::string(kXDGDesktopPortalObjectPath),
"org.freedesktop.portal.Background",
@@ -186,7 +192,6 @@ PortalAutostart::PortalAutostart(bool start, bool silent) {
QGuiApplicationPrivate::showModalWindow(this);
loop.exec();
QGuiApplicationPrivate::hideModalWindow(this);
connection->signal_unsubscribe(signalId);
}
} catch (const Glib::Error &e) {
if (!silent) {