Destroy GLWindow on exit to prevent issues closing the app while in fullscreen

This commit is contained in:
James Rowe 2019-12-15 16:20:59 -07:00
parent 36c5058d66
commit 408e225048
3 changed files with 15 additions and 5 deletions

View file

@ -359,11 +359,7 @@ void GRenderWindow::resizeEvent(QResizeEvent* event) {
}
void GRenderWindow::InitRenderTarget() {
// Destroy the previous run's child_widget which should also destroy the child_window
if (child_widget) {
layout()->removeWidget(child_widget);
delete child_widget;
}
ReleaseRenderTarget();
GMainWindow* parent = GetMainWindow();
QWindow* parent_win_handle = parent ? parent->windowHandle() : nullptr;
@ -379,6 +375,14 @@ void GRenderWindow::InitRenderTarget() {
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) {
if (res_scale == 0)
res_scale = VideoCore::GetResolutionScaleFactor();