UI: MemPlumber::getCaller: Check for isStarted()

This commit is contained in:
Nodir Temirkhodjaev 2024-07-17 13:44:15 +05:00
parent 994bc43ee6
commit 4c6ea29491

View File

@ -98,12 +98,14 @@ class MemPlumberInternal {
} }
} }
bool isVerbose() { bool isVerbose() const {
return m_Verbose && m_Dumper != NULL; return m_Verbose && m_Dumper != NULL;
} }
public: public:
bool isStarted() const { return m_Started; }
static MemPlumberInternal& getInstance() { static MemPlumberInternal& getInstance() {
static MemPlumberInternal instance; static MemPlumberInternal instance;
return instance; return instance;
@ -360,6 +362,9 @@ class MemPlumberInternal {
// We can use dbghelp but it's not supported on MinGW. Need to figure out a way to solve it on all platforms // We can use dbghelp but it's not supported on MinGW. Need to figure out a way to solve it on all platforms
const char* getCaller() { const char* getCaller() {
if (!MemPlumberInternal::getInstance().isStarted())
return "";
#ifdef USE_CPPTRACE #ifdef USE_CPPTRACE
const auto objTrace = cpptrace::generate_object_trace(/*skip=*/3, /*max_depth=*/1); const auto objTrace = cpptrace::generate_object_trace(/*skip=*/3, /*max_depth=*/1);
const auto trace = objTrace.resolve(); const auto trace = objTrace.resolve();