From ca5cc32dc1fc8a87fa9a33e1c7781d38c27740b9 Mon Sep 17 00:00:00 2001 From: raviola Date: Sat, 8 Oct 2022 18:42:15 +1100 Subject: [PATCH] Use smart pointer --- filament/src/details/Engine.cpp | 8 ++------ filament/src/details/Engine.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/filament/src/details/Engine.cpp b/filament/src/details/Engine.cpp index 195c4f1add..715b930e2d 100644 --- a/filament/src/details/Engine.cpp +++ b/filament/src/details/Engine.cpp @@ -259,8 +259,8 @@ void FEngine::init() { SYSTRACE_CALL(); #if FILAMENT_ENABLE_FGDBG - if (!debug.fgdbg) { - debug.fgdbg = new fgdbg::DebugServer(); + if (!debug.fgdbg) { + debug.fgdbg = std::make_unique(); } #endif @@ -402,10 +402,6 @@ void FEngine::shutdown() { ASSERT_PRECONDITION(ThreadUtils::isThisThread(mMainThreadId), "Engine::shutdown() called from the wrong thread!"); -#if FILAMENT_ENABLE_FGDBG - delete debug.fgdbg; -#endif - #ifndef NDEBUG // print out some statistics about this run size_t wm = mCommandBufferQueue.getHighWatermark(); diff --git a/filament/src/details/Engine.h b/filament/src/details/Engine.h index 578254e40f..a5ad230dad 100644 --- a/filament/src/details/Engine.h +++ b/filament/src/details/Engine.h @@ -528,7 +528,7 @@ public: bool doFrameCapture = false; } renderer; matdbg::DebugServer* server = nullptr; - fgdbg::DebugServer* fgdbg = nullptr; + std::unique_ptr fgdbg = nullptr; } debug; };