From b7308fa3ad08ac736dff68b417bf4aa1dac9d08b Mon Sep 17 00:00:00 2001 From: Automatic Release Builder Date: Tue, 6 Oct 2020 11:34:03 +0100 Subject: [PATCH] Add a hasInstance to ResourceManager This is needed to allow order-independent shutdown, due to the dumb ownership behaviour for providers. --- simgear/misc/ResourceManager.cxx | 5 +++++ simgear/misc/ResourceManager.hxx | 2 ++ 2 files changed, 7 insertions(+) diff --git a/simgear/misc/ResourceManager.cxx b/simgear/misc/ResourceManager.cxx index 59454dce..ec538f1b 100644 --- a/simgear/misc/ResourceManager.cxx +++ b/simgear/misc/ResourceManager.cxx @@ -49,6 +49,11 @@ ResourceManager* ResourceManager::instance() return static_manager; } +bool ResourceManager::haveInstance() +{ + return static_manager != nullptr; +} + ResourceManager::~ResourceManager() { assert(this == static_manager); diff --git a/simgear/misc/ResourceManager.hxx b/simgear/misc/ResourceManager.hxx index b957f0de..ac81e651 100644 --- a/simgear/misc/ResourceManager.hxx +++ b/simgear/misc/ResourceManager.hxx @@ -47,6 +47,8 @@ public: static ResourceManager* instance(); + static bool haveInstance(); + static void reset(); /**