mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix possible crash in pinned messages destruction.
This commit is contained in:
parent
819925fc72
commit
9509c88ef9
1 changed files with 11 additions and 3 deletions
|
@ -204,12 +204,20 @@ rpl::producer<HistoryItem*> PinnedBarItemWithReplyMarkup(
|
||||||
|
|
||||||
const auto messageFlag = [=](not_null<HistoryItem*> item) {
|
const auto messageFlag = [=](not_null<HistoryItem*> item) {
|
||||||
using Update = Data::MessageUpdate;
|
using Update = Data::MessageUpdate;
|
||||||
session->changes().messageFlagsValue(
|
session->changes().messageUpdates(
|
||||||
item,
|
item,
|
||||||
Update::Flag::ReplyMarkup
|
Update::Flag::ReplyMarkup | Update::Flag::Destroyed
|
||||||
) | rpl::start_with_next([=](const Update &update) {
|
) | rpl::start_with_next([=](const Update &update) {
|
||||||
pushUnique(update.item);
|
if (update.flags & Update::Flag::Destroyed) {
|
||||||
|
state->lifetime.destroy();
|
||||||
|
invalidate_weak_ptrs(&state->guard);
|
||||||
|
state->hasReplyMarkup = false;
|
||||||
|
consumer.put_next(nullptr);
|
||||||
|
} else {
|
||||||
|
pushUnique(update.item);
|
||||||
|
}
|
||||||
}, state->lifetime);
|
}, state->lifetime);
|
||||||
|
pushUnique(item);
|
||||||
};
|
};
|
||||||
if (const auto item = session->data().message(fullId)) {
|
if (const auto item = session->data().message(fullId)) {
|
||||||
messageFlag(item);
|
messageFlag(item);
|
||||||
|
|
Loading…
Add table
Reference in a new issue