diff --git a/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp index 60cc600ea1..8c78d507cd 100644 --- a/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt2/Debugger/CodeWidget.cpp @@ -247,6 +247,9 @@ void CodeWidget::Update() void CodeWidget::UpdateCallstack() { + if (Core::GetState() == Core::State::Starting) + return; + m_callstack_list->clear(); std::vector stack; diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 6b06bd0a12..289a556b1a 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -565,7 +565,7 @@ void MainWindow::FullScreen() // settings. If it's set to be fullscreen then it just remakes the window, // which probably isn't ideal. bool was_fullscreen = m_render_widget->isFullScreen(); - HideRenderWidget(); + HideRenderWidget(false); if (was_fullscreen) ShowRenderWidget(); else @@ -629,7 +629,7 @@ void MainWindow::ShowRenderWidget() { // Otherwise, just show it. m_rendering_to_main = false; - if (SConfig::GetInstance().bFullscreen) + if (SConfig::GetInstance().bFullscreen && !m_render_widget->isFullScreen()) { m_render_widget->showFullScreen(); } @@ -641,7 +641,7 @@ void MainWindow::ShowRenderWidget() } } -void MainWindow::HideRenderWidget() +void MainWindow::HideRenderWidget(bool reinit) { if (m_rendering_to_main) { @@ -654,19 +654,23 @@ void MainWindow::HideRenderWidget() setWindowTitle(QString::fromStdString(Common::scm_rev_str)); } + m_render_widget->hide(); + // The following code works around a driver bug that would lead to Dolphin crashing when changing // graphics backends (e.g. OpenGL to Vulkan). To avoid this the render widget is (safely) // recreated - disconnect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop); + if (reinit) + { + disconnect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop); - m_render_widget->hide(); - m_render_widget->removeEventFilter(this); - m_render_widget->deleteLater(); + m_render_widget->removeEventFilter(this); + m_render_widget->deleteLater(); - m_render_widget = new RenderWidget; + m_render_widget = new RenderWidget; - m_render_widget->installEventFilter(this); - connect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop); + m_render_widget->installEventFilter(this); + connect(m_render_widget, &RenderWidget::Closed, this, &MainWindow::ForceStop); + } } void MainWindow::ShowControllersWindow() diff --git a/Source/Core/DolphinQt2/MainWindow.h b/Source/Core/DolphinQt2/MainWindow.h index 47fa09f287..e324185385 100644 --- a/Source/Core/DolphinQt2/MainWindow.h +++ b/Source/Core/DolphinQt2/MainWindow.h @@ -100,7 +100,7 @@ private: void StartGame(const std::string& path, const std::optional& savestate_path = {}); void StartGame(std::unique_ptr&& parameters); void ShowRenderWidget(); - void HideRenderWidget(); + void HideRenderWidget(bool reinit = true); void ShowSettingsWindow(); void ShowGeneralWindow(); diff --git a/Source/Core/DolphinQt2/RenderWidget.cpp b/Source/Core/DolphinQt2/RenderWidget.cpp index 019cae9975..879f318ecf 100644 --- a/Source/Core/DolphinQt2/RenderWidget.cpp +++ b/Source/Core/DolphinQt2/RenderWidget.cpp @@ -49,6 +49,12 @@ void RenderWidget::HandleCursorTimer() setCursor(Qt::BlankCursor); } +void RenderWidget::showFullScreen() +{ + QWidget::showFullScreen(); + emit SizeChanged(width(), height()); +} + bool RenderWidget::event(QEvent* event) { switch (event->type()) diff --git a/Source/Core/DolphinQt2/RenderWidget.h b/Source/Core/DolphinQt2/RenderWidget.h index 4a01c0ac1f..565fdb9243 100644 --- a/Source/Core/DolphinQt2/RenderWidget.h +++ b/Source/Core/DolphinQt2/RenderWidget.h @@ -17,6 +17,7 @@ public: explicit RenderWidget(QWidget* parent = nullptr); bool event(QEvent* event) override; + void showFullScreen(); signals: void EscapePressed();