diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-03-25 16:41:48 -0300 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-03-25 17:10:34 -0300 |
commit | 9ff72ca9f2147ff41101d60fb806357825d5aa53 (patch) | |
tree | 8a489f13fc6c7ce90c2eaa8ce407f8c254668bcb /src/yuzu/bootmanager.cpp | |
parent | 5f2d9f282aa31c9658f044e7095d3ecbe12105eb (diff) |
bootmanager: Delete container to avoid crash on game restarting
While we are at it, remove nullptr checks for deletion, since the C++
standard defines that delete does it by its own
Diffstat (limited to 'src/yuzu/bootmanager.cpp')
-rw-r--r-- | src/yuzu/bootmanager.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index ea55e68ba..8445d9fe3 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -340,21 +340,16 @@ std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedCont } void GRenderWindow::InitRenderTarget() { - if (shared_context) { - shared_context.reset(); - } + shared_context.reset(); + context.reset(); - if (context) { - context.reset(); - } + delete child; + child = nullptr; - if (child) { - delete child; - } + delete container; + container = nullptr; - if (layout()) { - delete layout(); - } + delete layout(); first_frame = false; @@ -375,7 +370,7 @@ void GRenderWindow::InitRenderTarget() { fmt.setSwapInterval(false); child = new GGLWidgetInternal(this, shared_context.get()); - QWidget* container = QWidget::createWindowContainer(child, this); + container = QWidget::createWindowContainer(child, this); QBoxLayout* layout = new QHBoxLayout(this); resize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height); |