mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fix a race condition with asynchronous notification sending
This commit is contained in:
parent
5dbe429e6b
commit
66fc9b38df
1 changed files with 9 additions and 2 deletions
|
@ -141,7 +141,7 @@ bool UseGNotification() {
|
|||
|
||||
} // namespace
|
||||
|
||||
class Manager::Private {
|
||||
class Manager::Private : public base::has_weak_ptr {
|
||||
public:
|
||||
explicit Private(not_null<Manager*> manager);
|
||||
|
||||
|
@ -750,7 +750,7 @@ void Manager::Private::showNotification(
|
|||
|
||||
const auto callbackWrap = gi::unwrap(
|
||||
Gio::AsyncReadyCallback(
|
||||
crl::guard(weak, [=](
|
||||
crl::guard(this, [=](
|
||||
GObject::Object,
|
||||
Gio::AsyncResult res) {
|
||||
auto &sandbox = Core::Sandbox::Instance();
|
||||
|
@ -767,6 +767,13 @@ void Manager::Private::showNotification(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!weak) {
|
||||
_interface.call_close_notification(
|
||||
std::get<1>(*result),
|
||||
nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
weak->id = std::get<1>(*result);
|
||||
});
|
||||
})),
|
||||
|
|
Loading…
Add table
Reference in a new issue