diff --git a/include/wx/object.h b/include/wx/object.h index 7c161ab113..a882a36e6e 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -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; } diff --git a/src/common/object.cpp b/src/common/object.cpp index 7148e579b3..bbbf5350e3 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -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 )