mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
Rebind Info wrap teardown when a sublist is replaced
Task: 2026/08/21/resubscribe-info-wrap-teardown-on-replaced-sublist
This commit is contained in:
@@ -146,7 +146,11 @@ WrapWidget::WrapWidget(
|
||||
});
|
||||
}, lifetime());
|
||||
restoreHistoryStack(memento->takeStack());
|
||||
subscribeToThreadDestroyed();
|
||||
}
|
||||
|
||||
void WrapWidget::subscribeToThreadDestroyed() {
|
||||
_threadDestroyedLifetime.destroy();
|
||||
if (const auto topic = _controller->topic()) {
|
||||
topic->destroyed(
|
||||
) | rpl::on_next([=] {
|
||||
@@ -160,9 +164,8 @@ WrapWidget::WrapWidget(
|
||||
} else {
|
||||
_removeRequests.fire({});
|
||||
}
|
||||
}, lifetime());
|
||||
}
|
||||
if (const auto sublist = _controller->sublist()) {
|
||||
}, _threadDestroyedLifetime);
|
||||
} else if (const auto sublist = _controller->sublist()) {
|
||||
sublist->destroyed(
|
||||
) | rpl::on_next([=] {
|
||||
const auto parent = _controller->parentController();
|
||||
@@ -175,7 +178,7 @@ WrapWidget::WrapWidget(
|
||||
Window::SectionShow::Way::ClearStack,
|
||||
anim::type::instant));
|
||||
_removeRequests.fire({});
|
||||
}, lifetime());
|
||||
}, _threadDestroyedLifetime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1040,6 +1043,7 @@ void WrapWidget::showNewContent(
|
||||
showNewContent(memento);
|
||||
}
|
||||
}
|
||||
subscribeToThreadDestroyed();
|
||||
|
||||
if (animationParams) {
|
||||
if (Ui::InFocusChain(this)) {
|
||||
|
||||
@@ -188,6 +188,7 @@ private:
|
||||
void showNewContent(
|
||||
not_null<ContentMemento*> memento,
|
||||
const Window::SectionShow ¶ms);
|
||||
void subscribeToThreadDestroyed();
|
||||
bool returnToFirstStackFrame(
|
||||
not_null<ContentMemento*> memento,
|
||||
const Window::SectionShow ¶ms);
|
||||
@@ -246,6 +247,7 @@ private:
|
||||
|
||||
std::vector<StackItem> _historyStack;
|
||||
rpl::event_stream<> _removeRequests;
|
||||
rpl::lifetime _threadDestroyedLifetime;
|
||||
bool _shortcutsSetup = false;
|
||||
|
||||
rpl::event_stream<rpl::producer<int>> _desiredHeights;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Info wrap `destroyed()` teardown now rebinds when `showNewContent` replaces the controller, using a wrap-owned lifetime so an old sublist cannot tear down a wrap that no longer shows it. The constructor path still subscribes.
|
||||
Reference in New Issue
Block a user