mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed memory leak from bar of pinned messages.
This commit is contained in:
parent
a4856e4436
commit
659a7622be
1 changed files with 3 additions and 3 deletions
|
@ -84,13 +84,13 @@ void PinnedBar::setContent(rpl::producer<Ui::MessageBarContent> content) {
|
||||||
void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> button) {
|
void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> button) {
|
||||||
const auto hasPrevious = (_right.button != nullptr);
|
const auto hasPrevious = (_right.button != nullptr);
|
||||||
if (auto previous = _right.button.release()) {
|
if (auto previous = _right.button.release()) {
|
||||||
_right.previousButtonLifetime.make_state<RightButton>(
|
using Unique = base::unique_qptr<Ui::FadeWrapScaled<Ui::RpWidget>>;
|
||||||
RightButton::fromRaw(std::move(previous)));
|
_right.previousButtonLifetime = previous->shownValue(
|
||||||
_right.previousButtonLifetime = previous->toggledValue(
|
|
||||||
) | rpl::filter(!rpl::mappers::_1) | rpl::start_with_next([=] {
|
) | rpl::filter(!rpl::mappers::_1) | rpl::start_with_next([=] {
|
||||||
_right.previousButtonLifetime.destroy();
|
_right.previousButtonLifetime.destroy();
|
||||||
});
|
});
|
||||||
previous->hide(anim::type::normal);
|
previous->hide(anim::type::normal);
|
||||||
|
_right.previousButtonLifetime.make_state<Unique>(Unique{ previous });
|
||||||
}
|
}
|
||||||
_right.button.create(_wrap.entity(), std::move(button));
|
_right.button.create(_wrap.entity(), std::move(button));
|
||||||
if (_right.button) {
|
if (_right.button) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue