]> git.saurik.com Git - wxWidgets.git/commitdiff
tidied up patch 583937 (wxClassInfo dtor)
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 13 Aug 2002 22:37:41 +0000 (22:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 13 Aug 2002 22:37:41 +0000 (22:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/object.h
src/common/object.cpp

index 7c161ab1135b867e9f64a6bb4e0801980ed16783..a882a36e6ed08f36b2e597fc55e294b045012751 100644 (file)
@@ -74,26 +74,7 @@ public:
         , m_next(sm_first)
         { sm_first = this; }
 
-    ~wxClassInfo()
-    {
-        if (sm_first == this)
-        {
-            sm_first = m_next;
-        }
-        else
-        {
-            wxClassInfo * info = sm_first;
-            while (info)
-            {
-                if (info->m_next == this)
-                {
-                    info->m_next = m_next;
-                    break;
-                }
-                info = info->m_next;
-            }
-        }
-    }
+    ~wxClassInfo();
 
     wxObject *CreateObject() { return m_objectConstructor ? (*m_objectConstructor)() : 0; }
 
index 7148e579b3d60835cdd18d08bec5ce46e2c89ca0..bbbf5350e3ae294217dd2ca63780a0cc600845cd 100644 (file)
@@ -136,6 +136,31 @@ void wxObject::operator delete[] (void * buf, const wxChar*  WXUNUSED(fileName),
 // wxClassInfo
 // ----------------------------------------------------------------------------
 
+wxClassInfo::~wxClassInfo()
+{
+    // remove this object from the linked list of all class infos: if we don't
+    // do it, loading/unloading a DLL containing static wxClassInfo objects is
+    // not going to work
+    if ( this == sm_first )
+    {
+        sm_first = m_next;
+    }
+    else
+    {
+        wxClassInfo *info = sm_first;
+        while (info)
+        {
+            if ( info->m_next == this )
+            {
+                info->m_next = m_next;
+                break;
+            }
+
+            info = info->m_next;
+        }
+    }
+}
+
 wxClassInfo *wxClassInfo::FindClass(const wxChar *className)
 {
     if ( sm_classTable )