File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -2296,6 +2296,9 @@ Target::GetScratchTypeSystemForLanguage(lldb::LanguageType language,
22962296 // thread) is holding a read lock to the scratch context and
22972297 // replacing it could cause a use-after-free later on.
22982298 if (GetSwiftScratchContextLock ().try_lock ()) {
2299+ auto unlock = llvm::make_scope_exit ([this ] {
2300+ GetSwiftScratchContextLock ().unlock ();
2301+ });
22992302 if (m_use_scratch_typesystem_per_module)
23002303 DisplayFallbackSwiftContextErrors (swift_ast_ctx);
23012304 else if (StreamSP errs = GetDebugger ().GetAsyncErrorStream ()) {
@@ -2345,7 +2348,6 @@ Target::GetScratchTypeSystemForLanguage(lldb::LanguageType language,
23452348 llvm::make_error<llvm::StringError>(" DIAF" , llvm::inconvertibleErrorCode ());
23462349 }
23472350 }
2348- GetSwiftScratchContextLock ().unlock ();
23492351 }
23502352 }
23512353 } else if (create_on_demand) {
You can’t perform that action at this time.
0 commit comments