From dbbeaa30aea4e5de1bfb2d61a8a2cc8c86df5c7a Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Tue, 7 Jan 2025 00:40:03 -0500 Subject: [PATCH] JService::Init always called inside JApplication::Initialize() --- src/libraries/JANA/JApplication.cc | 4 ++++ src/libraries/JANA/Services/JServiceLocator.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/libraries/JANA/JApplication.cc b/src/libraries/JANA/JApplication.cc index 1df10802f..ee8a33033 100644 --- a/src/libraries/JANA/JApplication.cc +++ b/src/libraries/JANA/JApplication.cc @@ -151,6 +151,10 @@ void JApplication::Initialize() { topology_builder->create_topology(); auto execution_engine = m_service_locator->get(); + + // Make sure that Init() is called on any remaining JServices + m_service_locator->wire_everything(); + m_initialized = true; // This needs to be at the end so that m_initialized==false while InitPlugin() is being called } diff --git a/src/libraries/JANA/Services/JServiceLocator.h b/src/libraries/JANA/Services/JServiceLocator.h index 21cfd0218..3be0206d1 100644 --- a/src/libraries/JANA/Services/JServiceLocator.h +++ b/src/libraries/JANA/Services/JServiceLocator.h @@ -46,6 +46,7 @@ class JServiceLocator { std::lock_guard lock(mutex); auto svc = std::dynamic_pointer_cast(t); assert(svc != nullptr); + svc->SetTypeName(JTypeInfo::demangle()); underlying[std::type_index(typeid(T))] = svc; }