From 53f14895fe3778324033c1dedcd1b193257856e1 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sun, 14 Nov 2021 19:47:26 -0500 Subject: [PATCH] Small fixes to gamemode code --- indra/newview/algamemode.cpp | 8 ++++++++ indra/newview/algamemode.h | 8 ++++---- indra/newview/llappviewerlinux.cpp | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/indra/newview/algamemode.cpp b/indra/newview/algamemode.cpp index 580e2576713..8ef5ba9aed2 100644 --- a/indra/newview/algamemode.cpp +++ b/indra/newview/algamemode.cpp @@ -32,12 +32,20 @@ #include <boost/signals2.hpp> +// static +ALGameMode& ALGameMode::instance() +{ + static ALGameMode inst; + return inst; +} + void ALGameMode::init() { enable(gSavedSettings.getBool("AlchemyGameModeEnable")); gSavedSettings.getControl("AlchemyGameModeEnable")->getCommitSignal()->connect(boost::bind(&ALGameMode::onToggleGameModeControl, this)); } +// static void ALGameMode::shutdown() { gamemode_request_end(); diff --git a/indra/newview/algamemode.h b/indra/newview/algamemode.h index 4ee293fff81..8fc18db3cca 100644 --- a/indra/newview/algamemode.h +++ b/indra/newview/algamemode.h @@ -28,16 +28,16 @@ class ALGameMode final { public: - static ALGameMode &instance() { static ALGameMode inst; return inst;} + static ALGameMode &instance(); void enable(bool enable); void init(); - void shutdown(); + static void shutdown(); protected: void onToggleGameModeControl(); - bool mEnabled; - short mStatus; + bool mEnabled = false; + short mStatus = 0; }; #endif // AL_GAMEMODE_H diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 8c383ab15e6..7a8ecb0ada1 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -118,7 +118,7 @@ int main( int argc, char **argv ) sentry_close(); #endif - ALGameMode::instance().shutdown(); + ALGameMode::shutdown(); return 0; } -- GitLab