X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5385fa5b024c85439cd2e8271cfb2591e36439be..a44f14cf0c7606d5e6158b17c81ea5e5052f1671:/src/common/dynload.cpp diff --git a/src/common/dynload.cpp b/src/common/dynload.cpp index ac6aa37030..ded5bbd2d6 100644 --- a/src/common/dynload.cpp +++ b/src/common/dynload.cpp @@ -60,7 +60,7 @@ public: { wxPluginLibrary::ms_classes = new wxDLImports; wxPluginManager::CreateManifest(); - return TRUE; + return true; } virtual void OnExit() @@ -120,13 +120,13 @@ bool wxPluginLibrary::UnrefLib() wxASSERT_MSG( m_objcount == 0, _T("Library unloaded before all objects were destroyed") ); - if ( --m_linkcount == 0 ) + if ( m_linkcount == 0 || --m_linkcount == 0 ) { delete this; - return TRUE; + return true; } - return FALSE; + return false; } // ------------------------ @@ -148,6 +148,10 @@ void wxPluginLibrary::UpdateClasses() void wxPluginLibrary::RestoreClasses() { + // Check if there is a need to restore classes. + if (!ms_classes) + return; + for(wxClassInfo *info = m_after; info != m_before; info = info->m_next) { ms_classes->erase(ms_classes->find(info->m_className)); @@ -312,7 +316,7 @@ bool wxPluginManager::UnloadLibrary(const wxString& libname) wxLogDebug(_T("Attempt to unload library '%s' which is not loaded."), libname.c_str()); - return FALSE; + return false; } wxLogTrace(_T("dll"), _T("UnloadLibrary(%s)"), realname.c_str()); @@ -320,12 +324,12 @@ bool wxPluginManager::UnloadLibrary(const wxString& libname) if ( !entry->UnrefLib() ) { // not really unloaded yet - return FALSE; + return false; } ms_manifest->erase(ms_manifest->find(realname)); - return TRUE; + return true; } // ------------------------ @@ -416,7 +420,7 @@ wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name, bool *success) wxFAIL_MSG( _T("Using a library not loaded with wxDllLoader?") ); if ( success ) - *success = FALSE; + *success = false; return NULL; } @@ -522,13 +526,13 @@ wxLibraries::wxLibraries():m_loaded(wxKEY_STRING) wxLibraries::~wxLibraries() { - wxNode *node = m_loaded.First(); + wxNode *node = m_loaded.GetFirst(); while (node) { - wxLibrary *lib = (wxLibrary *)node->Data(); + wxLibrary *lib = (wxLibrary *)node->GetData(); delete lib; - node = node->Next(); + node = node->GetNext(); } } @@ -539,7 +543,7 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) wxNode *node = m_loaded.Find(name.GetData()); if (node != NULL) - return ((wxLibrary *)node->Data()); + return ((wxLibrary *)node->GetData()); // If DLL shares data, this is necessary. old_sm_first = wxClassInfo::sm_first; @@ -547,7 +551,7 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) wxString libname = ConstructLibraryName(name); - bool success = FALSE; + bool success = false; wxDllType handle = wxDllLoader::LoadLibrary(libname, &success); if(success) { @@ -563,15 +567,15 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) wxObject *wxLibraries::CreateObject(const wxString& path) { - wxNode *node = m_loaded.First(); + wxNode *node = m_loaded.GetFirst(); wxObject *obj; while (node) { - obj = ((wxLibrary *)node->Data())->CreateObject(path); + obj = ((wxLibrary *)node->GetData())->CreateObject(path); if (obj) return obj; - node = node->Next(); + node = node->GetNext(); } return NULL; }