summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.cpp10
-rw-r--r--src/core/core.h7
2 files changed, 10 insertions, 7 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index b0dc594d4..5893a86bf 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -4,6 +4,7 @@
4 4
5#include <array> 5#include <array>
6#include <atomic> 6#include <atomic>
7#include <exception>
7#include <memory> 8#include <memory>
8#include <utility> 9#include <utility>
9 10
@@ -423,9 +424,16 @@ struct System::Impl {
423System::System() : impl{std::make_unique<Impl>(*this)} {} 424System::System() : impl{std::make_unique<Impl>(*this)} {}
424System::~System() = default; 425System::~System() = default;
425 426
427System& System::GetInstance() {
428 if (!s_instance) {
429 throw std::runtime_error("Using System instance before its initialization");
430 }
431 return *s_instance;
432}
433
426void System::InitializeGlobalInstance() { 434void System::InitializeGlobalInstance() {
427 if (s_instance) { 435 if (s_instance) {
428 abort(); 436 throw std::runtime_error("Reinitializing Global System instance.");
429 } 437 }
430 s_instance = std::unique_ptr<System>(new System); 438 s_instance = std::unique_ptr<System>(new System);
431} 439}
diff --git a/src/core/core.h b/src/core/core.h
index 65b447a1c..f9116ebb6 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -120,12 +120,7 @@ public:
120 * Gets the instance of the System singleton class. 120 * Gets the instance of the System singleton class.
121 * @returns Reference to the instance of the System singleton class. 121 * @returns Reference to the instance of the System singleton class.
122 */ 122 */
123 [[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance() { 123 [[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
124 if (!s_instance) {
125 abort();
126 }
127 return *s_instance;
128 }
129 124
130 static void InitializeGlobalInstance(); 125 static void InitializeGlobalInstance();
131 126