Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion api/debuggercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,10 @@ void DebuggerController::RemoveEventCallback(size_t index)

void DebuggerController::SetDebuggerUICallbacks(DebuggerUICallbacks* cb)
{
BNDebuggerSetDebuggerUICallbacks(m_object, cb->GetCallbacks(), cb);
if (cb)
BNDebuggerSetDebuggerUICallbacks(m_object, cb->GetCallbacks(), cb);
else
BNDebuggerSetDebuggerUICallbacks(m_object, nullptr, nullptr);
}


Expand Down
5 changes: 4 additions & 1 deletion core/debuggercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4757,7 +4757,10 @@ Ref<Settings> DebuggerController::GetAdapterSettings()

void DebuggerController::SetDebuggerUICallbacks(BNDebuggerUICallbacks* cb, void* ctxt)
{
m_uiCallbacks = std::make_unique<DebuggerUICallbacks>(cb, ctxt);
if (cb)
m_uiCallbacks = std::make_unique<DebuggerUICallbacks>(cb, ctxt);
else
m_uiCallbacks.reset();
}


Expand Down
3 changes: 3 additions & 0 deletions ui/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,9 @@ DebuggerUI::DebuggerUI(UIContext* context, DebuggerControllerRef controller) :

DebuggerUI::~DebuggerUI()
{
// Unregister UI callbacks from the controller before deleting them, so the controller
// does not invoke a dangling callback if events arrive after the UI is destroyed.
m_controller->SetDebuggerUICallbacks(nullptr);
if (m_uiCallbacks)
{
delete m_uiCallbacks;
Expand Down