inline void Cleanup() { Libs::iterator it; for (it = s_Libs.begin(); it != s_Libs.end(); ++it) { RefCountedLib& rcl = it->second; // only delete the lib if not shutting down // if we are shutting down, it will be deleted automatically if (!Manager::IsAppShuttingDown()) delete rcl.lib; } s_Libs.clear(); }
inline void RemoveLibrary(wxDynamicLibrary* lib) { Libs::iterator it; for (it = s_Libs.begin(); it != s_Libs.end(); ++it) { RefCountedLib& rcl = it->second; if (rcl.lib == lib) { // found rcl.ref--; if (rcl.ref == 0) { // only delete the lib if not shutting down // if we are shutting down, it will be deleted automatically if (!Manager::IsAppShuttingDown()) delete rcl.lib; s_Libs.erase(it); } return; } } // if we reached here, it's a lib that was not handled by us // (or had wrong refcounting) }