diff --git a/src/core/debug.cpp b/src/core/debug.cpp index f570f1c9..b1e3bba5 100644 --- a/src/core/debug.cpp +++ b/src/core/debug.cpp @@ -43,8 +43,8 @@ namespace } auto key = cblist.begin()->first; auto tmp = cblist.begin()->second.begin(); - cblist.begin()->second.erase(cblist.begin()->second.begin()); (*tmp)->killed(key, type); + cblist.begin()->second.erase(cblist.begin()->second.begin()); } cblist.clear(); } diff --git a/src/platform/wxwidgets/tracelogger.cpp b/src/platform/wxwidgets/tracelogger.cpp index f4541644..c4d34724 100644 --- a/src/platform/wxwidgets/tracelogger.cpp +++ b/src/platform/wxwidgets/tracelogger.cpp @@ -555,7 +555,7 @@ namespace void callback(const debug_context::params& params); void killed(uint64_t addr, debug_context::etype type); void do_rwx_break(uint64_t addr, uint64_t value, debug_context::etype type); - void kill_debug_hooks(); + void kill_debug_hooks(bool kill_hard = false); scroll_bar* scroll; _panel* panel; bool broken; @@ -593,15 +593,18 @@ namespace closing = true; } - void wxwin_tracelog::kill_debug_hooks() + void wxwin_tracelog::kill_debug_hooks(bool kill_hard) { - CORE().dbg->remove_callback(cpuid, debug_context::DEBUG_TRACE, *this); - CORE().dbg->remove_callback(cpuid, debug_context::DEBUG_FRAME, *this); + if(!kill_hard) + CORE().dbg->remove_callback(cpuid, debug_context::DEBUG_TRACE, *this); + if(!kill_hard) + CORE().dbg->remove_callback(cpuid, debug_context::DEBUG_FRAME, *this); threads::alock h(buffer_mutex); for(auto& i : rwx_breakpoints) { if(!i.second) continue; - CORE().dbg->remove_callback(i.first.first, i.first.second, *this); + if(!kill_hard) + CORE().dbg->remove_callback(i.first.first, i.first.second, *this); i.second = false; } trace_active = false; @@ -768,17 +771,14 @@ namespace case debug_context::DEBUG_EXEC: { //We need to kill this hook if still active. auto i2 = std::make_pair(addr, type); - auto& h = rwx_breakpoints[i2]; - if(h) - inst.dbg->remove_callback(addr, type, *this); - h = false; + rwx_breakpoints[i2] = false; break; } case debug_context::DEBUG_TRACE: //Dtor! if(!trace_active) return; - kill_debug_hooks(); + kill_debug_hooks(true); runuifun([this]() { this->enabled->SetValue(false); this->enabled->Enable(false);