2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 02:07:24 +00:00

Fix crash in forum removal with new tabs.

This commit is contained in:
John Preston 2025-08-14 17:01:23 +04:00
parent 96360619e1
commit f9bf40a771
3 changed files with 6 additions and 1 deletions

View File

@ -456,7 +456,7 @@ ChatWidget::~ChatWidget() {
if (_repliesRootId) {
controller()->sendingAnimation().clear();
}
if (_subsectionTabs) {
if (_subsectionTabs && !_subsectionTabs->dying()) {
_subsectionTabsLifetime.destroy();
controller()->saveSubsectionTabs(base::take(_subsectionTabs));
}

View File

@ -510,6 +510,10 @@ void SubsectionTabs::toggleModes() {
_layoutRequests.fire({});
}
bool SubsectionTabs::dying() const {
return !UsedFor(_history);
}
rpl::producer<> SubsectionTabs::removeRequests() const {
if (const auto forum = _history->peer->forum()) {
return forum->destroyed();

View File

@ -49,6 +49,7 @@ public:
[[nodiscard]] static bool UsedFor(not_null<Data::Thread*> thread);
[[nodiscard]] bool dying() const;
[[nodiscard]] rpl::producer<> removeRequests() const;
void extractToParent(not_null<Ui::RpWidget*> parent);