From 46411e0fb9303de05e4029f36b9be30400296979 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 26 Jun 2007 23:11:13 +0000 Subject: [PATCH] fixed a bug where sdktools would crash if bintools was unloaded first --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401029 --- extensions/sdktools/extension.cpp | 23 +++++++++++++++++++++++ extensions/sdktools/extension.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/extensions/sdktools/extension.cpp b/extensions/sdktools/extension.cpp index d799b18c..6481baf6 100644 --- a/extensions/sdktools/extension.cpp +++ b/extensions/sdktools/extension.cpp @@ -97,3 +97,26 @@ bool SDKTools::QueryRunning(char *error, size_t maxlength) return true; } + +bool SDKTools::QueryInterfaceDrop(SMInterface *pInterface) +{ + if (pInterface == g_pBinTools) + { + return false; + } + + return IExtensionInterface::QueryInterfaceDrop(pInterface); +} + +void SDKTools::NotifyInterfaceDrop(SMInterface *pInterface) +{ + List::iterator iter; + for (iter = g_RegCalls.begin(); + iter != g_RegCalls.end(); + iter++) + { + delete (*iter); + } + g_RegCalls.clear(); + +} diff --git a/extensions/sdktools/extension.h b/extensions/sdktools/extension.h index 48cde279..9693a67c 100644 --- a/extensions/sdktools/extension.h +++ b/extensions/sdktools/extension.h @@ -47,6 +47,8 @@ public: virtual void SDK_OnAllLoaded(); //virtual void SDK_OnPauseChange(bool paused); virtual bool QueryRunning(char *error, size_t maxlength); + virtual bool QueryInterfaceDrop(SMInterface *pInterface); + virtual void NotifyInterfaceDrop(SMInterface *pInterface); public: #if defined SMEXT_CONF_METAMOD virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late);