Ensure that getGlobalScope always returns the same object

This commit is contained in:
Lukas Aldershaab 2023-10-08 19:43:31 +02:00 committed by Brian Roberts
parent 2c9f6a5350
commit ee93dc3b57
3 changed files with 7 additions and 7 deletions

View file

@ -34,8 +34,6 @@ END_IMPLEMENT_CLASS;
IMPLEMENT_NONINSTANTIABLE_CLASS( EngineExportScope, IMPLEMENT_NONINSTANTIABLE_CLASS( EngineExportScope,
"A scope contained a collection of exported engine API entities." ) "A scope contained a collection of exported engine API entities." )
END_IMPLEMENT_CLASS; END_IMPLEMENT_CLASS;
EngineExportScope EngineExportScope::smGlobalScope;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -142,9 +142,6 @@ class EngineExportScope : public EngineExport
/// Head of the link chain of exports for this scope. /// Head of the link chain of exports for this scope.
EngineExport* mExports; EngineExport* mExports;
/// The global export scope singleton.
static EngineExportScope smGlobalScope;
public: public:
@ -158,7 +155,12 @@ class EngineExportScope : public EngineExport
/// Return the global export scope singleton. This is the root of the /// Return the global export scope singleton. This is the root of the
/// export hierarchy and thus directly or indirectly contains all /// export hierarchy and thus directly or indirectly contains all
/// entities exported by the engine. /// entities exported by the engine.
static EngineExportScope* getGlobalScope() { return &smGlobalScope; } static EngineExportScope* getGlobalScope()
{
/// The global export scope singleton.
static EngineExportScope sGlobalScope;
return &sGlobalScope;
}
/// Return the chain of exports associated with this scope. /// Return the chain of exports associated with this scope.
EngineExport* getExports() const { return mExports; } EngineExport* getExports() const { return mExports; }

View file

@ -26,5 +26,5 @@
const EngineTypeInfo* const _EngineTypeTraits< void >::TYPEINFO = NULL; const EngineTypeInfo* const _EngineTypeTraits< void >::TYPEINFO = NULL;
EngineExportScope& _GLOBALSCOPE::__engineExportScope() EngineExportScope& _GLOBALSCOPE::__engineExportScope()
{ {
return EngineExportScope::smGlobalScope; return *EngineExportScope::getGlobalScope();
} }