Index: code/trunk/src/libraries/core/CorePrereqs.h
===================================================================
--- code/trunk/src/libraries/core/CorePrereqs.h	(revision 7844)
+++ code/trunk/src/libraries/core/CorePrereqs.h	(revision 7849)
@@ -138,4 +138,5 @@
     class ConfigValueContainer;
     class Core;
+    class DestructionListener;
     class DynLib;
     class DynLibManager;
Index: code/trunk/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.cc	(revision 7844)
+++ code/trunk/src/libraries/core/OrxonoxClass.cc	(revision 7849)
@@ -37,5 +37,4 @@
 #include "MetaObjectList.h"
 #include "Identifier.h"
-#include "WeakPtr.h"
 
 namespace orxonox
@@ -56,5 +55,5 @@
 
     /**
-        @brief Destructor: Removes the object from the object-lists, notifies all @ref WeakPtr "weak pointers" that this object is being deleted.
+        @brief Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example @ref WeakPtr "weak pointers") that this object is being deleted.
     */
     OrxonoxClass::~OrxonoxClass()
@@ -71,6 +70,6 @@
             delete this->parents_;
 
-        // reset all weak pointers pointing to this object
-        for (std::set<WeakPtr<OrxonoxClass>*>::iterator it = this->weakPointers_.begin(); it != this->weakPointers_.end(); )
+        // notify all destruction listeners
+        for (std::set<DestructionListener*>::iterator it = this->destructionListeners_.begin(); it != this->destructionListeners_.end(); )
             (*(it++))->objectDeleted();
     }
Index: code/trunk/src/libraries/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.h	(revision 7844)
+++ code/trunk/src/libraries/core/OrxonoxClass.h	(revision 7849)
@@ -74,6 +74,5 @@
         friend class SmartPtr;
 
-        template <class T>
-        friend class WeakPtr;
+        friend class DestructionListener;
 
         public:
@@ -169,19 +168,17 @@
             }
 
-            /// Register a weak pointer which points to this object.
-            template <class T>
-            inline void registerWeakPtr(WeakPtr<T>* pointer)
-                { this->weakPointers_.insert(reinterpret_cast<WeakPtr<OrxonoxClass>*>(pointer)); }
-            /// Unegister a weak pointer which pointed to this object before.
-            template <class T>
-            inline void unregisterWeakPtr(WeakPtr<T>* pointer)
-                { this->weakPointers_.erase(reinterpret_cast<WeakPtr<OrxonoxClass>*>(pointer)); }
-
-            Identifier* identifier_;                            //!< The Identifier of the object
-            std::set<const Identifier*>* parents_;              //!< List of all parents of the object
-            MetaObjectList* metaList_;                          //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
-            int referenceCount_;                                //!< Counts the references from smart pointers to this object
-            bool requestedDestruction_;                         //!< Becomes true after someone called delete on this object
-            std::set<WeakPtr<OrxonoxClass>*> weakPointers_;     //!< All weak pointers which point to this object (and like to get notified if it dies)
+            /// Register a destruction listener (for example a weak pointer which points to this object).
+            inline void registerDestructionListener(DestructionListener* pointer)
+                { this->destructionListeners_.insert(pointer); }
+            /// Unegister a destruction listener (for example a weak pointer which pointed to this object before).
+            inline void unregisterDestructionListener(DestructionListener* pointer)
+                { this->destructionListeners_.erase(pointer); }
+
+            Identifier* identifier_;                                //!< The Identifier of the object
+            std::set<const Identifier*>* parents_;                  //!< List of all parents of the object
+            MetaObjectList* metaList_;                              //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
+            int referenceCount_;                                    //!< Counts the references from smart pointers to this object
+            bool requestedDestruction_;                             //!< Becomes true after someone called delete on this object
+            std::set<DestructionListener*> destructionListeners_;   //!< All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies)
 
             /// 'Fast map' that holds this-pointers of all derived types
@@ -189,6 +186,21 @@
     };
 
+    /**
+        @brief This listener is used to inform weak pointers if an object of type OrxonoxClass gets destroyed.
+    */
+    class _CoreExport DestructionListener
+    {
+        friend class OrxonoxClass;
+
+        protected:
+            inline void registerAsDestructionListener(OrxonoxClass* object)
+                { object->registerDestructionListener(this); }
+            inline void unregisterAsDestructionListener(OrxonoxClass* object)
+                { object->unregisterDestructionListener(this); }
+
+            virtual void objectDeleted() = 0;
+    };
+
     SUPER_FUNCTION(11, OrxonoxClass, clone, false);
-
 }
 
Index: code/trunk/src/libraries/core/WeakPtr.h
===================================================================
--- code/trunk/src/libraries/core/WeakPtr.h	(revision 7844)
+++ code/trunk/src/libraries/core/WeakPtr.h	(revision 7849)
@@ -96,8 +96,6 @@
     */
     template <class T>
-    class WeakPtr
-    {
-        friend class OrxonoxClass;
-
+    class WeakPtr : public DestructionListener
+    {
         public:
             /// Constructor: Initializes the weak pointer with a null pointer.
@@ -115,5 +113,5 @@
             {
                 if (this->base_)
-                    this->base_->registerWeakPtr(this);
+                    this->registerAsDestructionListener(this->base_);
             }
 
@@ -122,5 +120,5 @@
             {
                 if (this->base_)
-                    this->base_->registerWeakPtr(this);
+                    this->registerAsDestructionListener(this->base_);
             }
 
@@ -130,5 +128,5 @@
             {
                 if (this->base_)
-                    this->base_->registerWeakPtr(this);
+                    this->registerAsDestructionListener(this->base_);
             }
 
@@ -137,5 +135,5 @@
             {
                 if (this->base_)
-                    this->base_->unregisterWeakPtr(this);
+                    this->unregisterAsDestructionListener(this->base_);
 
             }
@@ -212,7 +210,7 @@
             {
                 if (this->base_)
-                    this->base_->unregisterWeakPtr(this);
+                    this->unregisterAsDestructionListener(this->base_);
                 if (other.base_)
-                    other.base_->unregisterWeakPtr(&other);
+                    other.unregisterAsDestructionListener(other.base_);
 
                 {
@@ -228,7 +226,7 @@
 
                 if (this->base_)
-                    this->base_->registerWeakPtr(this);
+                    this->registerAsDestructionListener(this->base_);
                 if (other.base_)
-                    other.base_->registerWeakPtr(&other);
+                    other.registerAsDestructionListener(other.base_);
             }
 
