2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-10-05 13:16:13 +00:00

Fix crash in SeparatePanel destruction.

We should destroy layers before panel widget destructor started.
We do it already for MainWindow in clearWidgetsHook.
This commit is contained in:
John Preston
2019-09-09 10:51:59 +03:00
parent 037b936613
commit 3a3bf84cfc
4 changed files with 23 additions and 12 deletions

View File

@@ -291,13 +291,23 @@ void SeparatePanel::ensureLayerCreated() {
) | rpl::filter([=] {
return _layer != nullptr; // Last hide finish is sent from destructor.
}) | rpl::start_with_next([=] {
if (Ui::InFocusChain(_layer)) {
setFocus();
}
_layer = nullptr;
destroyLayer();
}, _layer->lifetime());
}
void SeparatePanel::destroyLayer() {
if (!_layer) {
return;
}
auto layer = base::take(_layer);
const auto resetFocus = Ui::InFocusChain(layer);
if (resetFocus) {
setFocus();
}
layer = nullptr;
}
void SeparatePanel::showInner(base::unique_qptr<Ui::RpWidget> inner) {
Expects(!size().isEmpty());