mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix a crash in forwarded sender avatars.
This commit is contained in:
parent
9043c18725
commit
06d0e78b00
1 changed files with 9 additions and 4 deletions
|
@ -196,14 +196,19 @@ void HistoryMessageForwarded::create(
|
||||||
? originalSender->name()
|
? originalSender->name()
|
||||||
: originalHiddenSenderInfo->name)
|
: originalHiddenSenderInfo->name)
|
||||||
};
|
};
|
||||||
if (originalSender) {
|
if (const auto copy = originalSender) {
|
||||||
context.session = &originalSender->owner().session();
|
context.session = ©->owner().session();
|
||||||
context.customEmojiRepaint = [=] {
|
context.customEmojiRepaint = [=] {
|
||||||
originalSender->owner().requestItemRepaint(item);
|
// It is important to capture here originalSender by value,
|
||||||
|
// not capture the HistoryMessageForwarded* and read the
|
||||||
|
// originalSender field, because the components themselves
|
||||||
|
// get moved from place to place and the captured `this`
|
||||||
|
// pointer may become invalid, resulting in a crash.
|
||||||
|
copy->owner().requestItemRepaint(item);
|
||||||
};
|
};
|
||||||
phrase = Ui::Text::SingleCustomEmoji(
|
phrase = Ui::Text::SingleCustomEmoji(
|
||||||
context.session->data().customEmojiManager().peerUserpicEmojiData(
|
context.session->data().customEmojiManager().peerUserpicEmojiData(
|
||||||
originalSender,
|
copy,
|
||||||
st::fwdTextUserpicPadding));
|
st::fwdTextUserpicPadding));
|
||||||
}
|
}
|
||||||
if (!originalPostAuthor.isEmpty()) {
|
if (!originalPostAuthor.isEmpty()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue