Skip to content

Commit

Permalink
DebuggerController now only removes the controller from the global array
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 authored and plafosse committed Feb 22, 2024
1 parent ee1d1c5 commit cdf533b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions core/debuggercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ DebuggerController::DebuggerController(BinaryViewRef data)

DebuggerController::~DebuggerController()
{
// This is not necessary since m_state should have been deleted by DebuggerController::Destroy()
m_file = nullptr;
m_liveView = nullptr;

if (m_state)
{
delete m_state;
Expand Down Expand Up @@ -1174,14 +1176,11 @@ void DebuggerController::DeleteController(FileMetadataRef file)

void DebuggerController::Destroy()
{
DebuggerController::DeleteController(GetFile());
m_file = nullptr;
m_liveView = nullptr;
if (m_state)
{
delete m_state;
m_state = nullptr;
}
// Contrary to the name, DebuggerController::Destroy() actually only removes the object from the global debugger
// controller array (g_debuggerControllers). This enabling its ref count to go down to zero and eventually get freed.
// The actual cleanup happens in DebuggerController::~DebuggerController().
// TODO: I should change the function name later
DebuggerController::DeleteController(m_file);
}


Expand Down

0 comments on commit cdf533b

Please sign in to comment.