Destroy GLWindow on exit to prevent issues closing the app while in fullscreen
This commit is contained in:
parent
36c5058d66
commit
408e225048
|
@ -359,11 +359,7 @@ void GRenderWindow::resizeEvent(QResizeEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::InitRenderTarget() {
|
void GRenderWindow::InitRenderTarget() {
|
||||||
// Destroy the previous run's child_widget which should also destroy the child_window
|
ReleaseRenderTarget();
|
||||||
if (child_widget) {
|
|
||||||
layout()->removeWidget(child_widget);
|
|
||||||
delete child_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
GMainWindow* parent = GetMainWindow();
|
GMainWindow* parent = GetMainWindow();
|
||||||
QWindow* parent_win_handle = parent ? parent->windowHandle() : nullptr;
|
QWindow* parent_win_handle = parent ? parent->windowHandle() : nullptr;
|
||||||
|
@ -379,6 +375,14 @@ void GRenderWindow::InitRenderTarget() {
|
||||||
BackupGeometry();
|
BackupGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GRenderWindow::ReleaseRenderTarget() {
|
||||||
|
if (child_widget) {
|
||||||
|
layout()->removeWidget(child_widget);
|
||||||
|
delete child_widget;
|
||||||
|
child_widget = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) {
|
void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) {
|
||||||
if (res_scale == 0)
|
if (res_scale == 0)
|
||||||
res_scale = VideoCore::GetResolutionScaleFactor();
|
res_scale = VideoCore::GetResolutionScaleFactor();
|
||||||
|
|
|
@ -173,6 +173,9 @@ public:
|
||||||
|
|
||||||
void InitRenderTarget();
|
void InitRenderTarget();
|
||||||
|
|
||||||
|
/// Destroy the previous run's child_widget which should also destroy the child_window
|
||||||
|
void ReleaseRenderTarget();
|
||||||
|
|
||||||
void CaptureScreenshot(u32 res_scale, const QString& screenshot_path);
|
void CaptureScreenshot(u32 res_scale, const QString& screenshot_path);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -1019,6 +1019,9 @@ void GMainWindow::ShutdownGame() {
|
||||||
UpdateWindowTitle();
|
UpdateWindowTitle();
|
||||||
|
|
||||||
game_path.clear();
|
game_path.clear();
|
||||||
|
|
||||||
|
// When closing the game, destroy the GLWindow to clear the context after the game is closed
|
||||||
|
render_window->ReleaseRenderTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::StoreRecentFile(const QString& filename) {
|
void GMainWindow::StoreRecentFile(const QString& filename) {
|
||||||
|
|
Reference in New Issue