mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +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:
parent
037b936613
commit
3a3bf84cfc
@ -133,6 +133,13 @@ PanelController::PanelController(not_null<Controller*> process)
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
PanelController::~PanelController() {
|
||||
if (_saveSettingsTimer.isActive()) {
|
||||
saveSettings();
|
||||
}
|
||||
_panel->destroyLayer();
|
||||
}
|
||||
|
||||
void PanelController::activatePanel() {
|
||||
_panel->showAndActivate();
|
||||
}
|
||||
@ -386,11 +393,5 @@ void PanelController::saveSettings() const {
|
||||
Local::WriteExportSettings(settings);
|
||||
}
|
||||
|
||||
PanelController::~PanelController() {
|
||||
if (_saveSettingsTimer.isActive()) {
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace View
|
||||
} // namespace Export
|
||||
|
@ -35,6 +35,7 @@ class Panel;
|
||||
class PanelController {
|
||||
public:
|
||||
PanelController(not_null<Controller*> process);
|
||||
~PanelController();
|
||||
|
||||
void activatePanel();
|
||||
void stopWithConfirmation(FnMut<void()> callback = nullptr);
|
||||
@ -49,8 +50,6 @@ public:
|
||||
return ContentFromState(_process->state());
|
||||
}
|
||||
|
||||
~PanelController();
|
||||
|
||||
private:
|
||||
void fillParams(const PasswordCheckState &state);
|
||||
void stopExport();
|
||||
|
@ -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());
|
||||
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
LayerOptions options,
|
||||
anim::type animated);
|
||||
void showToast(const QString &text);
|
||||
void destroyLayer();
|
||||
|
||||
rpl::producer<> backRequests() const;
|
||||
rpl::producer<> closeRequests() const;
|
||||
|
Loading…
Reference in New Issue
Block a user