diff --git a/core/ExtensionSys.cpp b/core/ExtensionSys.cpp index 44072b07..9037d911 100644 --- a/core/ExtensionSys.cpp +++ b/core/ExtensionSys.cpp @@ -805,6 +805,13 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt) return false; } + /* Tell it to unload */ + if (pExt->IsLoaded()) + { + IExtensionInterface *pAPI = pExt->GetAPI(); + pAPI->OnExtensionUnload(); + } + /* First remove us from internal lists */ g_ShareSys.RemoveInterfaces(_pExt); m_Libs.remove(pExt); @@ -899,13 +906,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt) } } - /* Tell it to unload */ - if (pExt->IsLoaded()) - { - IExtensionInterface *pAPI = pExt->GetAPI(); - pAPI->OnExtensionUnload(); - } - pExt->Unload(); delete pExt;