mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Make watcher a pointer so that it doesn't get destroyed too soon
This commit is contained in:
parent
7727c0d249
commit
ac36e92447
1 changed files with 6 additions and 5 deletions
|
@ -76,16 +76,17 @@ NotificationsManager::postNotification(const QString &roomid,
|
|||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications");
|
||||
auto call = notifyApp.asyncCallWithArgumentList("Notify", argumentList);
|
||||
QDBusPendingCallWatcher watcher{QDBusPendingReply{call}};
|
||||
connect(&watcher,
|
||||
auto watcher = new QDBusPendingCall{QDBusPendingReply{call}};
|
||||
connect(watcher,
|
||||
&QDBusPendingCallWatcher::finished,
|
||||
this,
|
||||
[&watcher, this, &roomid, &eventid]() {
|
||||
if (watcher.reply().type() == QDBusMessage::ErrorMessage)
|
||||
[watcher, this, &roomid, &eventid]() {
|
||||
if (watcher->reply().type() == QDBusMessage::ErrorMessage)
|
||||
qDebug() << "D-Bus Error:" << watcher.reply().errorMessage();
|
||||
else
|
||||
notificationIds[watcher.reply().arguments().first().toUInt()] =
|
||||
notificationIds[watcher->reply().arguments().first().toUInt()] =
|
||||
roomEventId{roomid, eventid};
|
||||
delete watcher;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue