From 49cbaeaf857370c21b63ba17fcb3e5313a1340ce Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 24 Jul 2019 13:12:22 +1000 Subject: [PATCH] DolphinQt: Work around surface-already-created error in Wayland when stopping --- Source/Core/DolphinQt/MainWindow.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index ddd95a8939f4..4cbbafe4fc30 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1142,7 +1142,11 @@ void MainWindow::HideRenderWidget(bool reinit, bool is_exit) // Remove the widget from the stack and reparent it to nullptr, so that it can draw // itself in a new window if it wants. Disconnect the title updates. m_stack->removeWidget(m_render_widget); - m_render_widget->setParent(nullptr); + + // Don't bother unparenting it if we're going to destroy the window anyway. + if (!reinit) + m_render_widget->setParent(nullptr); + m_rendering_to_main = false; m_stack->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); disconnect(Host::GetInstance(), &Host::RequestTitle, this, &MainWindow::setWindowTitle); @@ -1154,9 +1158,7 @@ void MainWindow::HideRenderWidget(bool reinit, bool is_exit) // recreated if (reinit) { - m_render_widget->hide(); disconnect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop); - m_render_widget->removeEventFilter(this); m_render_widget->deleteLater();