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:
@@ -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());
|
||||
|
||||
|
Reference in New Issue
Block a user