mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2024-11-29 11:24:19 +01:00
Added unload logic for core and core-legacy; no crash on exit anymore
This commit is contained in:
parent
a08dc6056a
commit
08a462ac61
@ -1,5 +1,6 @@
|
||||
#include <assert.h>
|
||||
#include "sourcemm.h"
|
||||
#include "concommands.h"
|
||||
#include <loader_bridge.h>
|
||||
|
||||
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
@ -63,6 +64,19 @@ class VspBridge : public IVspBridge
|
||||
|
||||
virtual void Unload()
|
||||
{
|
||||
if (g_bIsTryingToUnload)
|
||||
{
|
||||
Error("Metamod:Source cannot be unloaded from VSP mode. Use \"meta unload\" to unload specific plugins.\n");
|
||||
return;
|
||||
}
|
||||
if (g_plugin_unload != NULL)
|
||||
{
|
||||
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads_Post, true);
|
||||
g_plugin_unload = NULL;
|
||||
}
|
||||
g_SMConVarAccessor.UnloadMetamodCommands();
|
||||
UnloadMetamod(false);
|
||||
}
|
||||
|
||||
virtual const char *GetDescription()
|
||||
|
@ -92,6 +92,18 @@ public:
|
||||
|
||||
virtual void Unload()
|
||||
{
|
||||
if (g_bIsTryingToUnload)
|
||||
{
|
||||
Error("Metamod:Source cannot be unloaded from VSP mode. Use \"meta unload\" to unload specific plugins.\n");
|
||||
return;
|
||||
}
|
||||
if (g_plugin_unload != NULL)
|
||||
{
|
||||
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads, false);
|
||||
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads_Post, true);
|
||||
g_plugin_unload = NULL;
|
||||
}
|
||||
mm_UnloadMetamod();
|
||||
}
|
||||
|
||||
virtual const char *GetDescription()
|
||||
|
@ -162,6 +162,7 @@ public:
|
||||
if (bridge == NULL)
|
||||
return;
|
||||
bridge->Unload();
|
||||
mm_UnloadMetamodLibrary();
|
||||
}
|
||||
virtual void Pause()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user