diff --git a/Telegram/SourceFiles/info/info_layer_widget.cpp b/Telegram/SourceFiles/info/info_layer_widget.cpp index 0ab65d2d82..49e0c74f94 100644 --- a/Telegram/SourceFiles/info/info_layer_widget.cpp +++ b/Telegram/SourceFiles/info/info_layer_widget.cpp @@ -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() { - _controller->restoreFloatPlayerDelegate(floatPlayerDelegate()); + restoreFloatPlayerDelegate(); } } // namespace Info diff --git a/Telegram/SourceFiles/info/info_layer_widget.h b/Telegram/SourceFiles/info/info_layer_widget.h index ff67fd4c34..c8b4f231ed 100644 --- a/Telegram/SourceFiles/info/info_layer_widget.h +++ b/Telegram/SourceFiles/info/info_layer_widget.h @@ -53,6 +53,9 @@ protected: void paintEvent(QPaintEvent *e) override; private: + void closeHook() override; + + void restoreFloatPlayerDelegate(); not_null<::Media::Player::FloatDelegate*> floatPlayerDelegate(); not_null floatPlayerWidget() override; not_null floatPlayerController() override; @@ -72,6 +75,8 @@ private: bool _inResize = false; bool _tillBottom = false; + bool _floatPlayerDelegateRestored = false; + }; } // namespace Info diff --git a/Telegram/SourceFiles/window/layer_widget.cpp b/Telegram/SourceFiles/window/layer_widget.cpp index cc1524bd49..24739ff8b8 100644 --- a/Telegram/SourceFiles/window/layer_widget.cpp +++ b/Telegram/SourceFiles/window/layer_widget.cpp @@ -666,7 +666,7 @@ void LayerStackWidget::showSpecialLayer( object_ptr 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); }