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) {
} }
} }
void LayerWidget::restoreFloatPlayerDelegate() {
if (!_floatPlayerDelegateRestored) {
_floatPlayerDelegateRestored = true;
_controller->restoreFloatPlayerDelegate(floatPlayerDelegate());
}
}
void LayerWidget::closeHook() {
restoreFloatPlayerDelegate();
}
LayerWidget::~LayerWidget() { LayerWidget::~LayerWidget() {
_controller->restoreFloatPlayerDelegate(floatPlayerDelegate()); restoreFloatPlayerDelegate();
} }
} // namespace Info } // namespace Info

View File

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

View File

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