Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions library/include/DebugManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ class DFHACK_EXPORT DebugManager : public std::vector<DebugCategory*> {

//! Get the singleton object
static DebugManager& getInstance() {
static DebugManager instance;
return instance;
// Plugins may still hold pointers to DebugManager's instance during shutdown.
// If DebugManager's dtor runs first, use-after-free may ensue.
// Intentionally leak to avoid this issue.
static DebugManager* instance = new DebugManager();
return *instance;
}

// don't bother to protect these with mutexes. we don't want to pay the
Expand Down