[Lldb-commits] [lldb] Allow multiple destroy callbacks in `SBDebugger::SetDestroyCallback()` (PR #89868)

via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 25 13:40:44 PDT 2024


================
@@ -743,10 +743,11 @@ DebuggerSP Debugger::CreateInstance(lldb::LogOutputCallback log_callback,
 }
 
 void Debugger::HandleDestroyCallback() {
-  if (m_destroy_callback) {
-    m_destroy_callback(GetID(), m_destroy_callback_baton);
-    m_destroy_callback = nullptr;
+  const lldb::user_id_t user_id = GetID();
----------------
royitaqi wrote:

I don't understand.

Were you referring to the `foreach` loop below and saying that since the container can be modified during the loop, the looping needs to be changed (e.g. to use the iterator instead of the `foreach` syntax)?

If you did meant to talk about the `user_id` then I don't think I understand how the `user_id` is related, because it seems it should be constant throughout the `HandleDestroyCallback` execution.

https://github.com/llvm/llvm-project/pull/89868


More information about the lldb-commits mailing list