summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-03-25 16:41:48 -0300
committerGravatar ReinUsesLisp2019-03-25 17:10:34 -0300
commit9ff72ca9f2147ff41101d60fb806357825d5aa53 (patch)
tree8a489f13fc6c7ce90c2eaa8ce407f8c254668bcb /src
parentQT: Hide GLWidget immediately after showing. (diff)
downloadyuzu-9ff72ca9f2147ff41101d60fb806357825d5aa53.tar.gz
yuzu-9ff72ca9f2147ff41101d60fb806357825d5aa53.tar.xz
yuzu-9ff72ca9f2147ff41101d60fb806357825d5aa53.zip
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')
-rw-r--r--src/yuzu/bootmanager.cpp21
-rw-r--r--src/yuzu/bootmanager.h3
2 files changed, 10 insertions, 14 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
340} 340}
341 341
342void GRenderWindow::InitRenderTarget() { 342void GRenderWindow::InitRenderTarget() {
343 if (shared_context) { 343 shared_context.reset();
344 shared_context.reset(); 344 context.reset();
345 }
346 345
347 if (context) { 346 delete child;
348 context.reset(); 347 child = nullptr;
349 }
350 348
351 if (child) { 349 delete container;
352 delete child; 350 container = nullptr;
353 }
354 351
355 if (layout()) { 352 delete layout();
356 delete layout();
357 }
358 353
359 first_frame = false; 354 first_frame = false;
360 355
@@ -375,7 +370,7 @@ void GRenderWindow::InitRenderTarget() {
375 fmt.setSwapInterval(false); 370 fmt.setSwapInterval(false);
376 371
377 child = new GGLWidgetInternal(this, shared_context.get()); 372 child = new GGLWidgetInternal(this, shared_context.get());
378 QWidget* container = QWidget::createWindowContainer(child, this); 373 container = QWidget::createWindowContainer(child, this);
379 QBoxLayout* layout = new QHBoxLayout(this); 374 QBoxLayout* layout = new QHBoxLayout(this);
380 375
381 resize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height); 376 resize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index d2a440d0d..c2f2fe87e 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -166,7 +166,8 @@ private:
166 void OnMinimalClientAreaChangeRequest( 166 void OnMinimalClientAreaChangeRequest(
167 const std::pair<unsigned, unsigned>& minimal_size) override; 167 const std::pair<unsigned, unsigned>& minimal_size) override;
168 168
169 GGLWidgetInternal* child; 169 QWidget* container = nullptr;
170 GGLWidgetInternal* child = nullptr;
170 171
171 QByteArray geometry; 172 QByteArray geometry;
172 173