JDevlieghere added inline comments.

================
Comment at: lldb/source/Core/Debugger.cpp:1973-1977
+HostThread &Debugger::SetIOHandlerThread(HostThread &new_thread) {
+  HostThread &old_host = m_io_handler_thread;
+  m_io_handler_thread = new_thread;
+  return old_host;
+}
----------------
bulbazord wrote:
> JDevlieghere wrote:
> > This doesn't look right. You're taking a reference to the old thread, and 
> > then immediately change it below. If you want to return the old thread, 
> > old_host should be a copy. 
> +1. Does it make sense to use a shared_ptr or a unique_ptr for HostThreads? 
> If so, we could use those.
I think the HostThread already kind of serves as a wrapper. I think the 
solution is to either just make a plain copy or call `Release()` and assign it 
to the `old_host` temporary. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145136/new/

https://reviews.llvm.org/D145136

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to