]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/object.cpp
forgot to commit some regenerated files
[wxWidgets.git] / src / common / object.cpp
index 212f195a28956414c787e0f740a0a7cf5efbc7f9..e29f32860c0da2173a3877729590c5f7adbbc856 100644 (file)
@@ -10,7 +10,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "object.h"
 #endif
 
@@ -215,52 +215,31 @@ wxClassInfo *wxClassInfo::FindClass(const wxChar *className)
     }
 }
 
-// Set pointers to base class(es) to speed up IsKindOf
-void wxClassInfo::InitializeClasses()
+void wxClassInfo::CleanUp()
 {
-    // using IMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you
-    // link any object module twice mistakenly) will break this function
-    // because it will enter an infinite loop and eventually die with "out of
-    // memory" - as this is quite hard to detect if you're unaware of this,
-    // try to do some checks here
-
-#ifdef __WXDEBUG__
-    static const size_t nMaxClasses = 10000;    // more than we'll ever have
-    size_t nClass = 0;
-#endif
-
-    // Do this initialization only once, because classes are added
-    // automatically if
-    if ( sm_classTable == NULL )
+    if ( sm_classTable )
     {
-        sm_classTable = new wxHashTable(wxKEY_STRING);
-
-        // Index all class infos by their class name:
-        wxClassInfo *info;
-        for(info = sm_first; info; info = info->m_next)
-        {
-            if (info->m_className)
-            {
-                wxASSERT_MSG( ++nClass < nMaxClasses,
-                              _T("an infinite loop detected - have you used IMPLEMENT_DYNAMIC_CLASS() twice (may be by linking some object module(s) twice)?") );
-                sm_classTable->Put(info->m_className, (wxObject *)info);
-            }
-        }
+        delete sm_classTable;
+        sm_classTable = NULL;
     }
 }
 
-void wxClassInfo::CleanUpClasses()
-{
-    delete wxClassInfo::sm_classTable;
-    wxClassInfo::sm_classTable = NULL;
-}
-
 void wxClassInfo::Register()
 {
-    if ( sm_classTable )
+    if ( !sm_classTable )
     {
-        sm_classTable->Put(m_className, (wxObject *)this);
+        sm_classTable = new wxHashTable(wxKEY_STRING);
     }
+
+    // using IMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you
+    // link any object module twice mistakenly) will break this function
+    // because it will enter an infinite loop and eventually die with "out of
+    // memory" - as this is quite hard to detect if you're unaware of this,
+    // try to do some checks here
+    wxASSERT_MSG( sm_classTable->Get(m_className) == NULL,
+                  _T("class already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() twice (may be by linking some object module(s) twice)?") );
+    
+    sm_classTable->Put(m_className, (wxObject *)this);
 }
 
 void wxClassInfo::Unregister()
@@ -268,6 +247,11 @@ void wxClassInfo::Unregister()
     if ( sm_classTable )
     {
         sm_classTable->Delete(m_className);
+        if ( sm_classTable->GetCount() == 0 )
+        {
+            delete sm_classTable;
+            sm_classTable = NULL;
+        }
     }
 }
 
@@ -380,34 +364,3 @@ wxObject::CloneRefData(const wxObjectRefData * WXUNUSED(data)) const
 
     return NULL;
 }
-
-// ----------------------------------------------------------------------------
-// misc
-// ----------------------------------------------------------------------------
-
-#if defined(__DARWIN__) && defined(WXMAKINGDLL)
-
-extern "C" {
-    void __initialize_Cplusplus(void);
-    void wxWindowsDylibInit(void);
-};
-
-// Dynamic shared library (dylib) initialization routine
-//   required to initialize static C++ objects bacause of lazy dynamic linking
-//   http://developer.apple.com/techpubs/macosx/Essentials/
-//          SystemOverview/Frameworks/Dynamic_Shared_Libraries.html
-
-void wxWindowsDylibInit()
-{
-    // The function __initialize_Cplusplus() must be called from the shared
-    // library initialization routine to cause the static C++ objects in
-    // the library to be initialized (reference number 2441683).
-
-    // This only seems to be necessary if the library initialization routine
-    // needs to use the static C++ objects
-    __initialize_Cplusplus();
-}
-
-#endif
-
-// vi:sts=4:sw=4:et