// here is the place to clean up and destroy the nsPluginInstance object NPError NPP_Destroy (NPP instance, NPSavedData** save) { DWORD dwTickEnter = XP_GetTickCount(); NPError ret = NPERR_NO_ERROR; CPluginBase * pPlugin = NULL; if(!instance) { ret = NPERR_INVALID_INSTANCE_ERROR; goto Return; } pPlugin = (CPluginBase *)instance->pdata; if(pPlugin) { if (pPlugin->isStandAlone()) pPlugin->shutStandAlone(); pPlugin->shut(); DestroyPlugin(pPlugin); goto Return; } Return: pLogger->blockDumpToFrame(TRUE); DWORD dwTickReturn = XP_GetTickCount(); pLogger->appendToLog(action_npp_destroy, dwTickEnter, dwTickReturn, (DWORD)ret, (DWORD)instance, (DWORD)save); pLogger->blockDumpToFrame(FALSE); // mark logger stale as the dll can remain in memory with no NP_Shutdown called // and then come back with NPP_New where we should recreate the logger pLogger->markStale(); return ret; }
bool TopMenuCore::shutdown() { TopMenu_PluginStackEntry* pStackPtr = m_pTopEntry; while(pStackPtr) { HMODULE hMod = pStackPtr->m_hModule; FARPROC destroyProc = GetProcAddress(hMod, DESTROY_PROC_NAME); if(destroyProc) { DESTROY_PROC& DestroyPlugin = (DESTROY_PROC&)*destroyProc; DestroyPlugin(pStackPtr->m_pPlugin); } FreeLibrary(hMod); //lint !e534 JLD TopMenu_PluginStackEntry* pCurrent = pStackPtr; pStackPtr = pStackPtr->m_pNext; delete pCurrent; pCurrent = NULL; } CloseHandle(m_hStopEvent); //lint !e534 JLD m_hStopEvent = NULL; return true; }
void MFX::MFXPluginFactory::Close() { for (MFXVector<FactoryRecord>::iterator i = mPlugins.begin(); i!= mPlugins.end(); i++) { DestroyPlugin(*i); } mPlugins.clear(); }
bool MFX::MFXPluginFactory::Destroy( const mfxPluginUID & uidToDestroy) { for (MFXVector<FactoryRecord >::iterator i = mPlugins.begin(); i!= mPlugins.end(); i++) { if (i->plgParams.PluginUID == uidToDestroy) { DestroyPlugin(*i); //dll unload should happen here //todo: check that dll_free fail is traced mPlugins.erase(i); return true; } } return false; }