Fix crash in stickers.

This commit is contained in:
John Preston 2020-05-31 12:18:24 +04:00
parent 9b574e497d
commit f4cd84c313
5 changed files with 10 additions and 11 deletions

View File

@ -3344,7 +3344,7 @@ void ApiWrap::readFeaturedSetDelayed(uint64 setId) {
}
void ApiWrap::readFeaturedSets() {
auto &sets = _session->data().stickerSetsRef();
const auto &sets = _session->data().stickerSets();
auto count = _session->data().featuredStickerSetsUnreadCount();
QVector<MTPlong> wrappedIds;
wrappedIds.reserve(_featuredSetsRead.size());

View File

@ -307,7 +307,7 @@ void StickerSetBox::Inner::gotSet(const MTPmessages_StickerSet &set) {
} else {
_setThumbnail = ImageWithLocation();
}
auto &sets = _controller->session().data().stickerSetsRef();
const auto &sets = _controller->session().data().stickerSets();
const auto it = sets.find(_setId);
if (it != sets.cend()) {
const auto set = it->second.get();

View File

@ -497,8 +497,8 @@ QPixmap StickersBox::grabContentCache() {
}
void StickersBox::installSet(uint64 setId) {
auto &sets = _session->data().stickerSetsRef();
auto it = sets.find(setId);
const auto &sets = _session->data().stickerSets();
const auto it = sets.find(setId);
if (it == sets.cend()) {
rebuildList();
return;
@ -535,8 +535,8 @@ void StickersBox::installDone(const MTPmessages_StickerSetInstallResult &result)
bool StickersBox::installFail(uint64 setId, const RPCError &error) {
if (MTP::isDefaultHandledError(error)) return false;
auto &sets = _session->data().stickerSetsRef();
auto it = sets.find(setId);
const auto &sets = _session->data().stickerSets();
const auto it = sets.find(setId);
if (it == sets.cend()) {
rebuildList();
return true;

View File

@ -173,8 +173,8 @@ void InstallLocally(uint64 setId) {
}
void UndoInstallLocally(uint64 setId) {
auto &sets = Auth().data().stickerSetsRef();
auto it = sets.find(setId);
const auto &sets = Auth().data().stickerSets();
const auto it = sets.find(setId);
if (it == sets.end()) {
return;
}
@ -400,7 +400,7 @@ void SetsReceived(const QVector<MTPStickerSet> &data, int32 hash) {
}
auto writeRecent = false;
auto &recent = GetRecentPack();
for (auto it = sets.begin(), e = sets.end(); it != e;) {
for (auto it = sets.begin(); it != sets.end();) {
const auto set = it->second.get();
bool installed = (set->flags & MTPDstickerSet::Flag::f_installed_date);
bool featured = (set->flags & MTPDstickerSet_ClientFlag::f_featured);
@ -657,7 +657,7 @@ void FeaturedSetsReceived(
}
auto unreadCount = 0;
for (auto it = sets.begin(), e = sets.end(); it != e;) {
for (auto it = sets.begin(); it != sets.end();) {
const auto set = it->second.get();
bool installed = (set->flags & MTPDstickerSet::Flag::f_installed_date);
bool featured = (set->flags & MTPDstickerSet_ClientFlag::f_featured);

View File

@ -2638,7 +2638,6 @@ std::vector<StickerIcon> StickersListWidget::fillIcons() {
result.emplace_back(Stickers::RecentSetId);
}
}
const auto &sets = session().data().stickerSets();
for (auto l = _mySets.size(); i != l; ++i) {
if (_mySets[i].id == Stickers::MegagroupSetId) {
result.emplace_back(Stickers::MegagroupSetId);