Couple more of crash fixes.

This commit is contained in:
John Preston 2021-09-01 13:45:32 +03:00
parent 6eb5d47c35
commit c208b5dc58
2 changed files with 10 additions and 3 deletions

View File

@ -1902,14 +1902,17 @@ void StickersBox::Inner::handleMegagroupSetAddressChange() {
void StickersBox::Inner::rebuildMegagroupSet() {
Expects(_megagroupSet != nullptr);
if (!_megagroupSetInput.id) {
const auto clearCurrent = [&] {
if (_megagroupSelectedSet) {
_megagroupSetField->setText(QString());
_megagroupSetField->finishAnimating();
}
_megagroupSelectedSet.reset();
_megagroupSelectedSet = nullptr;
_megagroupSelectedRemove.destroy();
_megagroupSelectedShadow.destroy();
};
if (!_megagroupSetInput.id) {
clearCurrent();
return;
}
auto setId = _megagroupSetInput.id;
@ -1917,6 +1920,10 @@ void StickersBox::Inner::rebuildMegagroupSet() {
auto it = sets.find(setId);
if (it == sets.cend()
|| (it->second->flags & SetFlag::NotLoaded)) {
// It may have been in sets and stored in _megagroupSelectedSet
// already, but then removed from sets. We need to clear the stored
// pointer, otherwise we may crash in paint event while loading.
clearCurrent();
session().api().scheduleStickerSetRequest(
_megagroupSetInput.id,
_megagroupSetInput.accessHash);

@ -1 +1 @@
Subproject commit 9729d6fd98cc78adfb005f98e20e18bf4aa03b2f
Subproject commit da56c0657473a89843df1d95519d0e94388dcc9b