X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d4957f2401a8814f90cda21ef945d99bc74596e..b6a20a20d010d643e52914f51aa0700df0da925f:/src/common/dynload.cpp diff --git a/src/common/dynload.cpp b/src/common/dynload.cpp index 80d809e528..5bb2496dff 100644 --- a/src/common/dynload.cpp +++ b/src/common/dynload.cpp @@ -120,7 +120,7 @@ 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; @@ -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)); @@ -222,7 +226,8 @@ void wxPluginLibrary::UnregisterModules() for ( it = m_wxmodules.begin(); it != m_wxmodules.end(); ++it ) wxModule::UnregisterModule( *it ); - WX_CLEAR_LIST(wxModuleList, m_wxmodules); + // NB: content of the list was deleted by UnregisterModule calls above: + m_wxmodules.clear(); } @@ -457,7 +462,7 @@ wxLibrary::wxLibrary(wxDllType handle) // Some system may use a local heap for library. get_first = (t_get_first)GetSymbol(_T("wxGetClassFirst")); - // It is a wxWindows DLL. + // It is a wxWidgets DLL. if (get_first) PrepareClasses(get_first()); }