Restore player delegate non-delayed (crashfix).

This commit is contained in:
John Preston 2018-11-09 19:16:27 +04:00
parent 2b95b96fa3
commit e5949dbb86
3 changed files with 19 additions and 3 deletions

View File

@ -253,8 +253,19 @@ void LayerWidget::paintEvent(QPaintEvent *e) {
}
}
LayerWidget::~LayerWidget() {
void LayerWidget::restoreFloatPlayerDelegate() {
if (!_floatPlayerDelegateRestored) {
_floatPlayerDelegateRestored = true;
_controller->restoreFloatPlayerDelegate(floatPlayerDelegate());
}
}
void LayerWidget::closeHook() {
restoreFloatPlayerDelegate();
}
LayerWidget::~LayerWidget() {
restoreFloatPlayerDelegate();
}
} // namespace Info

View File

@ -53,6 +53,9 @@ protected:
void paintEvent(QPaintEvent *e) override;
private:
void closeHook() override;
void restoreFloatPlayerDelegate();
not_null<::Media::Player::FloatDelegate*> floatPlayerDelegate();
not_null<Ui::RpWidget*> floatPlayerWidget() override;
not_null<Window::Controller*> floatPlayerController() override;
@ -72,6 +75,8 @@ private:
bool _inResize = false;
bool _tillBottom = false;
bool _floatPlayerDelegateRestored = false;
};
} // namespace Info

View File

@ -666,7 +666,7 @@ void LayerStackWidget::showSpecialLayer(
object_ptr<LayerWidget> layer,
anim::type animated) {
startAnimation([this, layer = std::move(layer)]() mutable {
_specialLayer.destroyDelayed();
_specialLayer.destroy();
_specialLayer = std::move(layer);
initChildLayer(_specialLayer);
}, [this] {
@ -699,7 +699,7 @@ void LayerStackWidget::showMainMenu(
_mainMenu->setParent(this);
}, [this] {
clearLayers();
_specialLayer.destroyDelayed();
_specialLayer.destroy();
}, Action::ShowMainMenu, animated);
}