@@ -57,7 +57,6 @@ Status TargetList::CreateTarget(Debugger &debugger,
5757 debugger, user_exe_path, triple_str, load_dependent_files,
5858 platform_options, target_sp);
5959
60- std::lock_guard<std::recursive_mutex> guard (m_target_list_mutex);
6160 if (target_sp && result.Success ())
6261 AddTargetInternal (target_sp, /* do_select*/ true );
6362 return result;
@@ -77,7 +76,6 @@ Status TargetList::CreateTarget(Debugger &debugger,
7776 debugger, user_exe_path, specified_arch, load_dependent_files,
7877 platform_sp, target_sp);
7978
80- std::lock_guard<std::recursive_mutex> guard (m_target_list_mutex);
8179 if (target_sp && result.Success ())
8280 AddTargetInternal (target_sp, /* do_select*/ true );
8381 return result;
@@ -531,6 +529,7 @@ uint32_t TargetList::GetIndexOfTarget(lldb::TargetSP target_sp) const {
531529}
532530
533531void TargetList::AddTargetInternal (TargetSP target_sp, bool do_select) {
532+ std::lock_guard<std::recursive_mutex> guard (m_target_list_mutex);
534533 lldbassert (!llvm::is_contained (m_target_list, target_sp) &&
535534 " target already exists it the list" );
536535 UnregisterInProcessTarget (target_sp);
0 commit comments