Use smart pointer

This commit is contained in:
raviola
2022-10-08 18:42:15 +11:00
parent 5c03e290c2
commit ca5cc32dc1
2 changed files with 3 additions and 7 deletions

View File

@@ -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<fgdbg::DebugServer>();
}
#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();

View File

@@ -528,7 +528,7 @@ public:
bool doFrameCapture = false;
} renderer;
matdbg::DebugServer* server = nullptr;
fgdbg::DebugServer* fgdbg = nullptr;
std::unique_ptr<fgdbg::DebugServer> fgdbg = nullptr;
} debug;
};