Use gsl::finally in PortalAutostart
This commit is contained in:
parent
b918170464
commit
67eba93e29
|
@ -172,6 +172,12 @@ PortalAutostart::PortalAutostart(bool start, bool silent) {
|
||||||
"Response",
|
"Response",
|
||||||
requestPath);
|
requestPath);
|
||||||
|
|
||||||
|
const auto signalGuard = gsl::finally([&] {
|
||||||
|
if (signalId != 0) {
|
||||||
|
connection->signal_unsubscribe(signalId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
connection->call_sync(
|
connection->call_sync(
|
||||||
std::string(kXDGDesktopPortalObjectPath),
|
std::string(kXDGDesktopPortalObjectPath),
|
||||||
"org.freedesktop.portal.Background",
|
"org.freedesktop.portal.Background",
|
||||||
|
@ -186,7 +192,6 @@ PortalAutostart::PortalAutostart(bool start, bool silent) {
|
||||||
QGuiApplicationPrivate::showModalWindow(this);
|
QGuiApplicationPrivate::showModalWindow(this);
|
||||||
loop.exec();
|
loop.exec();
|
||||||
QGuiApplicationPrivate::hideModalWindow(this);
|
QGuiApplicationPrivate::hideModalWindow(this);
|
||||||
connection->signal_unsubscribe(signalId);
|
|
||||||
}
|
}
|
||||||
} catch (const Glib::Error &e) {
|
} catch (const Glib::Error &e) {
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
|
|
Loading…
Reference in New Issue