Fix crash in poll view destruction.
This commit is contained in:
parent
f9be304e54
commit
d34eabdc11
|
@ -55,7 +55,7 @@ enum class MediaInBubbleState {
|
||||||
|
|
||||||
class Media : public Object {
|
class Media : public Object {
|
||||||
public:
|
public:
|
||||||
Media(not_null<Element*> parent) : _parent(parent) {
|
explicit Media(not_null<Element*> parent) : _parent(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] not_null<History*> history() const;
|
[[nodiscard]] not_null<History*> history() const;
|
||||||
|
@ -284,7 +284,7 @@ protected:
|
||||||
virtual void playAnimation(bool autoplay) {
|
virtual void playAnimation(bool autoplay) {
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<Element*> _parent;
|
const not_null<Element*> _parent;
|
||||||
MediaInBubbleState _inBubbleState = MediaInBubbleState::None;
|
MediaInBubbleState _inBubbleState = MediaInBubbleState::None;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -485,11 +485,27 @@ void Poll::updateRecentVoters() {
|
||||||
ranges::equal_to(),
|
ranges::equal_to(),
|
||||||
&RecentVoter::user);
|
&RecentVoter::user);
|
||||||
if (changed) {
|
if (changed) {
|
||||||
_recentVoters = ranges::view::all(
|
auto updated = ranges::view::all(
|
||||||
sliced
|
sliced
|
||||||
) | ranges::views::transform([](not_null<UserData*> user) {
|
) | ranges::views::transform([](not_null<UserData*> user) {
|
||||||
return RecentVoter{ user };
|
return RecentVoter{ user };
|
||||||
}) | ranges::to_vector;
|
}) | ranges::to_vector;
|
||||||
|
const auto has = hasHeavyPart();
|
||||||
|
if (has) {
|
||||||
|
for (auto &voter : updated) {
|
||||||
|
const auto i = ranges::find(
|
||||||
|
_recentVoters,
|
||||||
|
voter.user,
|
||||||
|
&RecentVoter::user);
|
||||||
|
if (i != end(_recentVoters)) {
|
||||||
|
voter.userpic = std::move(i->userpic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_recentVoters = std::move(updated);
|
||||||
|
if (has && !hasHeavyPart()) {
|
||||||
|
_parent->checkHeavyPart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,11 +80,13 @@ Sticker::Sticker(
|
||||||
|
|
||||||
Sticker::~Sticker() {
|
Sticker::~Sticker() {
|
||||||
if (_lottie || _dataMedia) {
|
if (_lottie || _dataMedia) {
|
||||||
unloadLottie();
|
if (_lottie) {
|
||||||
|
unloadLottie();
|
||||||
|
}
|
||||||
if (_dataMedia) {
|
if (_dataMedia) {
|
||||||
_data->owner().keepAlive(base::take(_dataMedia));
|
_data->owner().keepAlive(base::take(_dataMedia));
|
||||||
|
_parent->checkHeavyPart();
|
||||||
}
|
}
|
||||||
_parent->checkHeavyPart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue