summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2021-08-24 18:31:27 -0700
committerGravatar GitHub2021-08-24 18:31:27 -0700
commit4654fb96b0e2eb1b57857ae7f0438341fb2f9292 (patch)
tree4b257caf10eb6e7dfd2113671a7ebdcd845dcf3b /src/core
parentMerge pull request #6878 from BreadFish64/optimize-GetHostThreadID (diff)
parentlogging: Fix log filter during initialization (diff)
downloadyuzu-4654fb96b0e2eb1b57857ae7f0438341fb2f9292.tar.gz
yuzu-4654fb96b0e2eb1b57857ae7f0438341fb2f9292.tar.xz
yuzu-4654fb96b0e2eb1b57857ae7f0438341fb2f9292.zip
Merge pull request #6917 from ameerj/log-init-fix
logging: Fix log filter during initialization
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