mirror of https://github.com/procxx/kepka.git
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);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PanelController::~PanelController() {
|
||||||
|
if (_saveSettingsTimer.isActive()) {
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
_panel->destroyLayer();
|
||||||
|
}
|
||||||
|
|
||||||
void PanelController::activatePanel() {
|
void PanelController::activatePanel() {
|
||||||
_panel->showAndActivate();
|
_panel->showAndActivate();
|
||||||
}
|
}
|
||||||
|
@ -386,11 +393,5 @@ void PanelController::saveSettings() const {
|
||||||
Local::WriteExportSettings(settings);
|
Local::WriteExportSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelController::~PanelController() {
|
|
||||||
if (_saveSettingsTimer.isActive()) {
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace View
|
} // namespace View
|
||||||
} // namespace Export
|
} // namespace Export
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Panel;
|
||||||
class PanelController {
|
class PanelController {
|
||||||
public:
|
public:
|
||||||
PanelController(not_null<Controller*> process);
|
PanelController(not_null<Controller*> process);
|
||||||
|
~PanelController();
|
||||||
|
|
||||||
void activatePanel();
|
void activatePanel();
|
||||||
void stopWithConfirmation(FnMut<void()> callback = nullptr);
|
void stopWithConfirmation(FnMut<void()> callback = nullptr);
|
||||||
|
@ -49,8 +50,6 @@ public:
|
||||||
return ContentFromState(_process->state());
|
return ContentFromState(_process->state());
|
||||||
}
|
}
|
||||||
|
|
||||||
~PanelController();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fillParams(const PasswordCheckState &state);
|
void fillParams(const PasswordCheckState &state);
|
||||||
void stopExport();
|
void stopExport();
|
||||||
|
|
|
@ -291,13 +291,23 @@ void SeparatePanel::ensureLayerCreated() {
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
return _layer != nullptr; // Last hide finish is sent from destructor.
|
return _layer != nullptr; // Last hide finish is sent from destructor.
|
||||||
}) | rpl::start_with_next([=] {
|
}) | rpl::start_with_next([=] {
|
||||||
if (Ui::InFocusChain(_layer)) {
|
destroyLayer();
|
||||||
setFocus();
|
|
||||||
}
|
|
||||||
_layer = nullptr;
|
|
||||||
}, _layer->lifetime());
|
}, _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) {
|
void SeparatePanel::showInner(base::unique_qptr<Ui::RpWidget> inner) {
|
||||||
Expects(!size().isEmpty());
|
Expects(!size().isEmpty());
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
LayerOptions options,
|
LayerOptions options,
|
||||||
anim::type animated);
|
anim::type animated);
|
||||||
void showToast(const QString &text);
|
void showToast(const QString &text);
|
||||||
|
void destroyLayer();
|
||||||
|
|
||||||
rpl::producer<> backRequests() const;
|
rpl::producer<> backRequests() const;
|
||||||
rpl::producer<> closeRequests() const;
|
rpl::producer<> closeRequests() const;
|
||||||
|
|
Loading…
Reference in New Issue