mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 22:55:11 +00:00
Fixed memory leak from bar of pinned messages.
This commit is contained in:
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user