diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp
index cb6cea686..b0f84367a 100644
--- a/Telegram/SourceFiles/mainwindow.cpp
+++ b/Telegram/SourceFiles/mainwindow.cpp
@@ -533,13 +533,6 @@ void MainWindow::checkHistoryActivation() {
 	}
 }
 
-void MainWindow::layerHidden() {
-	destroyLayerDelayed();
-	hideMediaview();
-	setInnerFocus();
-	checkHistoryActivation();
-}
-
 bool MainWindow::contentOverlapped(const QRect &globalRect) {
 	if (_main && _main->contentOverlapped(globalRect)) return true;
 	if (_layerBg && _layerBg->contentOverlapped(globalRect)) return true;
@@ -739,7 +732,11 @@ void MainWindow::noLayerStack(LayerStackWidget *was) {
 
 void MainWindow::layerFinishedHide(LayerStackWidget *was) {
 	if (was == _layerBg) {
-		QTimer::singleShot(0, this, SLOT(layerHidden()));
+		destroyLayerDelayed();
+		InvokeQueued(this, [this] {
+			setInnerFocus();
+			checkHistoryActivation();
+		});
 	}
 }
 
diff --git a/Telegram/SourceFiles/mainwindow.h b/Telegram/SourceFiles/mainwindow.h
index af2634288..9d4094ea9 100644
--- a/Telegram/SourceFiles/mainwindow.h
+++ b/Telegram/SourceFiles/mainwindow.h
@@ -152,7 +152,6 @@ protected:
 
 public slots:
 	void showSettings();
-	void layerHidden();
 	void setInnerFocus();
 	void updateConnectingStatus();