diff --git a/lib/base/loader.cpp b/lib/base/loader.cpp index d15defb95..a4364de93 100644 --- a/lib/base/loader.cpp +++ b/lib/base/loader.cpp @@ -15,21 +15,24 @@ boost::thread_specific_ptr& Loader::Ge void Loader::ExecuteDeferredInitializers() { - if (!GetDeferredInitializers().get()) + auto& initializers = GetDeferredInitializers(); + if (!initializers.get()) return; - while (!GetDeferredInitializers().get()->empty()) { - DeferredInitializer initializer = GetDeferredInitializers().get()->top(); - GetDeferredInitializers().get()->pop(); + while (!initializers->empty()) { + DeferredInitializer initializer = initializers->top(); + initializers->pop(); initializer(); } } void Loader::AddDeferredInitializer(const std::function& callback, InitializePriority priority) { - if (!GetDeferredInitializers().get()) - GetDeferredInitializers().reset(new Loader::DeferredInitializerPriorityQueue()); + auto& initializers = GetDeferredInitializers(); + if (!initializers.get()) { + initializers.reset(new Loader::DeferredInitializerPriorityQueue()); + } - GetDeferredInitializers().get()->push(DeferredInitializer(callback, priority)); + initializers->push(DeferredInitializer(callback, priority)); }