diff --git a/core/systems/ExtensionSys.cpp b/core/systems/ExtensionSys.cpp index af9c47d2..04b78bd2 100644 --- a/core/systems/ExtensionSys.cpp +++ b/core/systems/ExtensionSys.cpp @@ -787,10 +787,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt) /* Unbind our natives from Core */ pExt->DropEverything(); - - /* Tell it to unload */ - pAPI = pExt->GetAPI(); - pAPI->OnExtensionUnload(); } IdentityToken_t *pIdentity; @@ -804,6 +800,13 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt) } } + /* Tell it to unload */ + if (pExt->IsLoaded()) + { + IExtensionInterface *pAPI = pExt->GetAPI(); + pAPI->OnExtensionUnload(); + } + pExt->Unload(); delete pExt;