From 8bd5db83b552a29b86badd4fb08c57ccf984fcce Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Sun, 23 Jul 2023 22:28:25 +0200 Subject: [PATCH] [core] Lock interpreter in TCling::GetClassSharedLibs Co-authored-by: Jonas Hahnfeld --- core/metacling/src/TCling.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/metacling/src/TCling.cxx b/core/metacling/src/TCling.cxx index 7d4feb3fc2c5c..9a3c805252f35 100644 --- a/core/metacling/src/TCling.cxx +++ b/core/metacling/src/TCling.cxx @@ -7025,6 +7025,11 @@ static std::string GetClassSharedLibsForModule(const char *cls, cling::LookupHel const char* TCling::GetClassSharedLibs(const char* cls) { if (fCxxModulesEnabled) { + // Lock the interpreter mutex before interacting with cling. + // TODO: Can we move this further deep? In principle the lock should be in + // GetClassSharedLibsForModule, but it might be needed also for + // getLookupHelper? + R__LOCKGUARD(gInterpreterMutex); llvm::StringRef className = cls; // If we get a class name containing lambda, we cannot parse it and we // can exit early.