mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix crash in viewed shared story deletion.
This commit is contained in:
parent
9d8d039886
commit
863313531d
2 changed files with 12 additions and 5 deletions
|
@ -692,10 +692,10 @@ void Stories::applyDeleted(FullStoryId id) {
|
||||||
if (i != end(_stories)) {
|
if (i != end(_stories)) {
|
||||||
const auto j = i->second.find(id.story);
|
const auto j = i->second.find(id.story);
|
||||||
if (j != end(i->second)) {
|
if (j != end(i->second)) {
|
||||||
// Duplicated in Stories::apply(peer, const MTPUserStories*).
|
const auto &story = _deletingStories[id] = std::move(j->second);
|
||||||
auto story = std::move(j->second);
|
|
||||||
_expiring.remove(story->expires(), story->fullId());
|
_expiring.remove(story->expires(), story->fullId());
|
||||||
i->second.erase(j);
|
i->second.erase(j);
|
||||||
|
|
||||||
session().changes().storyUpdated(
|
session().changes().storyUpdated(
|
||||||
story.get(),
|
story.get(),
|
||||||
UpdateFlag::Destroyed);
|
UpdateFlag::Destroyed);
|
||||||
|
@ -736,6 +736,7 @@ void Stories::applyDeleted(FullStoryId id) {
|
||||||
if (i->second.empty()) {
|
if (i->second.empty()) {
|
||||||
_stories.erase(i);
|
_stories.erase(i);
|
||||||
}
|
}
|
||||||
|
_deletingStories.remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1628,9 +1629,14 @@ bool Stories::registerPolling(FullStoryId id, Polling polling) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stories::unregisterPolling(FullStoryId id, Polling polling) {
|
void Stories::unregisterPolling(FullStoryId id, Polling polling) {
|
||||||
const auto maybeStory = lookup(id);
|
if (const auto maybeStory = lookup(id)) {
|
||||||
Assert(maybeStory.has_value());
|
unregisterPolling(*maybeStory, polling);
|
||||||
unregisterPolling(*maybeStory, polling);
|
} else if (const auto i = _deletingStories.find(id)
|
||||||
|
; i != end(_deletingStories)) {
|
||||||
|
unregisterPolling(i->second.get(), polling);
|
||||||
|
} else {
|
||||||
|
Unexpected("Couldn't find story for unregistering polling.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Stories::pollingInterval(const PollingSettings &settings) const {
|
int Stories::pollingInterval(const PollingSettings &settings) const {
|
||||||
|
|
|
@ -299,6 +299,7 @@ private:
|
||||||
std::unordered_map<
|
std::unordered_map<
|
||||||
PeerId,
|
PeerId,
|
||||||
base::flat_map<StoryId, std::unique_ptr<Story>>> _stories;
|
base::flat_map<StoryId, std::unique_ptr<Story>>> _stories;
|
||||||
|
base::flat_map<FullStoryId, std::unique_ptr<Story>> _deletingStories;
|
||||||
std::unordered_map<
|
std::unordered_map<
|
||||||
PeerId,
|
PeerId,
|
||||||
base::flat_map<StoryId, std::weak_ptr<HistoryItem>>> _items;
|
base::flat_map<StoryId, std::weak_ptr<HistoryItem>>> _items;
|
||||||
|
|
Loading…
Add table
Reference in a new issue