File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 66
77namespace my_mod {
88
9- static std::unique_ptr<MyMod> instance;
10-
11- MyMod& MyMod::getInstance () { return *instance; }
9+ MyMod& MyMod::getInstance () {
10+ static MyMod instance;
11+ return instance;
12+ }
1213
1314bool MyMod::load () {
1415 getSelf ().getLogger ().debug (" Loading..." );
@@ -30,4 +31,4 @@ bool MyMod::disable() {
3031
3132} // namespace my_mod
3233
33- LL_REGISTER_MOD (my_mod::MyMod, my_mod::instance );
34+ LL_REGISTER_MOD (my_mod::MyMod, my_mod::MyMod::getInstance() );
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ class MyMod {
99public:
1010 static MyMod& getInstance ();
1111
12- MyMod (ll::mod::NativeMod& self) : mSelf (self ) {}
12+ MyMod () : mSelf (* ll::mod::NativeMod::current () ) {}
1313
1414 [[nodiscard]] ll::mod::NativeMod& getSelf () const { return mSelf ; }
1515
You can’t perform that action at this time.
0 commit comments