Skip to content

v0.2.54..v0.2.55 changeset JsRegistrar.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-js/src/main/cpp/hoot/js/JsRegistrar.cpp b/hoot-js/src/main/cpp/hoot/js/JsRegistrar.cpp
index 9707171..2dd941d 100644
--- a/hoot-js/src/main/cpp/hoot/js/JsRegistrar.cpp
+++ b/hoot-js/src/main/cpp/hoot/js/JsRegistrar.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #include "JsRegistrar.h"
 
@@ -41,19 +41,11 @@ void Method(const FunctionCallbackInfo<Value>& args)
   args.GetReturnValue().Set(String::NewFromUtf8(current, "world"));
 }
 
-std::shared_ptr<JsRegistrar> JsRegistrar::_theInstance = NULL;
-
-JsRegistrar::JsRegistrar()
-{
-}
-
 JsRegistrar& JsRegistrar::getInstance()
 {
-  if (_theInstance == NULL)
-  {
-    _theInstance.reset(new JsRegistrar());
-  }
-  return *_theInstance;
+  //  Local static singleton instance
+  static JsRegistrar instance;
+  return instance;
 }
 
 void JsRegistrar::Init(Handle<Object> exports)
Clone this wiki locally