mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix crash in custom duration status set.
This commit is contained in:
parent
edb011dc0d
commit
bc90399ec3
2 changed files with 5 additions and 11 deletions
|
@ -62,10 +62,6 @@ void EmojiStatusPanel::setChooseFilter(Fn<bool(DocumentId)> filter) {
|
||||||
_chooseFilter = std::move(filter);
|
_chooseFilter = std::move(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmojiStatusPanel::setChooseCallback(Fn<void(DocumentId)> callback) {
|
|
||||||
_chooseCallback = std::move(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmojiStatusPanel::show(
|
void EmojiStatusPanel::show(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<QWidget*> button,
|
not_null<QWidget*> button,
|
||||||
|
@ -173,16 +169,16 @@ void EmojiStatusPanel::create(
|
||||||
return Chosen{ .animation = data.messageSendingFrom };
|
return Chosen{ .animation = data.messageSendingFrom };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const auto weak = Ui::MakeWeak(_panel.get());
|
||||||
const auto accept = [=](Chosen chosen) {
|
const auto accept = [=](Chosen chosen) {
|
||||||
Expects(chosen.until != Selector::kPickCustomTimeId);
|
Expects(chosen.until != Selector::kPickCustomTimeId);
|
||||||
|
|
||||||
|
// From PickUntilBox is called after EmojiStatusPanel is destroyed!
|
||||||
const auto owner = &controller->session().data();
|
const auto owner = &controller->session().data();
|
||||||
startAnimation(owner, body, chosen.id, chosen.animation);
|
if (weak) {
|
||||||
if (_chooseCallback) {
|
startAnimation(owner, body, chosen.id, chosen.animation);
|
||||||
_chooseCallback(chosen.id);
|
|
||||||
} else {
|
|
||||||
owner->emojiStatuses().set(chosen.id, chosen.until);
|
|
||||||
}
|
}
|
||||||
|
owner->emojiStatuses().set(chosen.id, chosen.until);
|
||||||
};
|
};
|
||||||
|
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
|
|
|
@ -41,7 +41,6 @@ public:
|
||||||
~EmojiStatusPanel();
|
~EmojiStatusPanel();
|
||||||
|
|
||||||
void setChooseFilter(Fn<bool(DocumentId)> filter);
|
void setChooseFilter(Fn<bool(DocumentId)> filter);
|
||||||
void setChooseCallback(Fn<void(DocumentId)> callback);
|
|
||||||
|
|
||||||
void show(
|
void show(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
|
@ -64,7 +63,6 @@ private:
|
||||||
|
|
||||||
base::unique_qptr<ChatHelpers::TabbedPanel> _panel;
|
base::unique_qptr<ChatHelpers::TabbedPanel> _panel;
|
||||||
Fn<bool(DocumentId)> _chooseFilter;
|
Fn<bool(DocumentId)> _chooseFilter;
|
||||||
Fn<void(DocumentId)> _chooseCallback;
|
|
||||||
QPointer<QWidget> _panelButton;
|
QPointer<QWidget> _panelButton;
|
||||||
std::unique_ptr<Ui::EmojiFlyAnimation> _animation;
|
std::unique_ptr<Ui::EmojiFlyAnimation> _animation;
|
||||||
Data::CustomEmojiSizeTag _animationSizeTag = {};
|
Data::CustomEmojiSizeTag _animationSizeTag = {};
|
||||||
|
|
Loading…
Add table
Reference in a new issue