[Orxonox-commit 4976] r9645 - code/branches/core6/src/libraries/core/class

landauf at orxonox.net landauf at orxonox.net
Tue Aug 13 21:39:31 CEST 2013


Author: landauf
Date: 2013-08-13 21:39:30 +0200 (Tue, 13 Aug 2013)
New Revision: 9645

Modified:
   code/branches/core6/src/libraries/core/class/Identifier.h
Log:
classIdentifier_s exists in multiple libraries - reset it everywhere if the Identifier is destroyed.

Modified: code/branches/core6/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.h	2013-08-11 20:42:57 UTC (rev 9644)
+++ code/branches/core6/src/libraries/core/class/Identifier.h	2013-08-13 19:39:30 UTC (rev 9645)
@@ -84,6 +84,8 @@
 #include "core/object/ObjectList.h"
 #include "core/object/Listable.h"
 #include "core/object/Context.h"
+#include "core/object/Destroyable.h"
+#include "core/object/WeakPtr.h"
 #include "IdentifierManager.h"
 #include "Super.h"
 
@@ -103,7 +105,7 @@
 
         @note You can't directly create an Identifier, it's just the base-class of ClassIdentifier<T>.
     */
-    class _CoreExport Identifier
+    class _CoreExport Identifier : public Destroyable
     {
         public:
             Identifier();
@@ -299,19 +301,17 @@
             ~ClassIdentifier()
             {
                 SuperFunctionDestruction<0, T>::destroy(this);
-                if (classIdentifier_s == this)
-                    classIdentifier_s = 0;
             }
 
             void updateConfigValues(bool updateChildren, Listable*) const;
             void updateConfigValues(bool updateChildren, Identifiable*) const;
 
             std::string typeidName_;
-            static ClassIdentifier<T>* classIdentifier_s;
+            static WeakPtr<ClassIdentifier<T> > classIdentifier_s;
     };
 
     template <class T>
-    ClassIdentifier<T>* ClassIdentifier<T>::classIdentifier_s = 0;
+    WeakPtr<ClassIdentifier<T> > ClassIdentifier<T>::classIdentifier_s;
 
     /**
         @brief Returns the only instance of this class.




More information about the Orxonox-commit mailing list