mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Fix couple of crashes in secondary windows.
This commit is contained in:
@@ -1192,9 +1192,11 @@ void MainWidget::setInnerFocus() {
|
||||
_mainSection->setInnerFocus();
|
||||
} else if (!_hider && _thirdSection) {
|
||||
_thirdSection->setInnerFocus();
|
||||
} else {
|
||||
Assert(_dialogs != nullptr);
|
||||
} else if (_dialogs) {
|
||||
_dialogs->setInnerFocus();
|
||||
} else {
|
||||
// Maybe we're just closing a child window, content is destroyed.
|
||||
_history->setFocus();
|
||||
}
|
||||
} else if (_mainSection) {
|
||||
_mainSection->setInnerFocus();
|
||||
@@ -1293,8 +1295,9 @@ void MainWidget::showHistory(
|
||||
}
|
||||
const auto unavailable = peer->computeUnavailableReason();
|
||||
if (!unavailable.isEmpty()) {
|
||||
Assert(isPrimary()); // windows todo
|
||||
if (params.activation != anim::activation::background) {
|
||||
if (!isPrimary()) {
|
||||
_controller->window().close();
|
||||
} else if (params.activation != anim::activation::background) {
|
||||
_controller->show(Ui::MakeInformBox(unavailable));
|
||||
_controller->window().activate();
|
||||
}
|
||||
@@ -1950,10 +1953,9 @@ void MainWidget::showNonPremiumLimitToast(bool download) {
|
||||
});
|
||||
}
|
||||
|
||||
void MainWidget::showBackFromStack(
|
||||
const SectionShow ¶ms) {
|
||||
bool MainWidget::showBackFromStack(const SectionShow ¶ms) {
|
||||
if (preventsCloseSection([=] { showBackFromStack(params); }, params)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_stack.empty()) {
|
||||
@@ -1963,7 +1965,7 @@ void MainWidget::showBackFromStack(
|
||||
crl::on_main(this, [=] {
|
||||
_controller->widget()->setInnerFocus();
|
||||
});
|
||||
return;
|
||||
return (_dialogs != nullptr);
|
||||
}
|
||||
auto item = std::move(_stack.back());
|
||||
_stack.pop_back();
|
||||
@@ -1995,6 +1997,7 @@ void MainWidget::showBackFromStack(
|
||||
anim::activation::background));
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWidget::orderWidgets() {
|
||||
|
Reference in New Issue
Block a user