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 @@ -2286,6 +2286,9 @@ Target::GetScratchTypeSystemForLanguage(lldb::LanguageType language,
2286
2286
// thread) is holding a read lock to the scratch context and
2287
2287
// replacing it could cause a use-after-free later on.
2288
2288
if (GetSwiftScratchContextLock ().try_lock ()) {
2289
+ auto unlock = llvm::make_scope_exit ([this ] {
2290
+ GetSwiftScratchContextLock ().unlock ();
2291
+ });
2289
2292
if (m_use_scratch_typesystem_per_module)
2290
2293
DisplayFallbackSwiftContextErrors (swift_ast_ctx);
2291
2294
else if (StreamSP errs = GetDebugger ().GetAsyncErrorStream ()) {
@@ -2335,7 +2338,6 @@ Target::GetScratchTypeSystemForLanguage(lldb::LanguageType language,
2335
2338
llvm::make_error<llvm::StringError>(" DIAF" , llvm::inconvertibleErrorCode ());
2336
2339
}
2337
2340
}
2338
- GetSwiftScratchContextLock ().unlock ();
2339
2341
}
2340
2342
}
2341
2343
} else if (create_on_demand) {
You can’t perform that action at this time.
0 commit comments