From 5523bc40d8c773c643e119f1a907ced6424e35dd Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 17 Dec 2024 11:59:46 +0700 Subject: [PATCH] fix crash unloading plugin --- plugins/Base/ToolboxUIPlugin.cpp | 10 ---------- plugins/Base/ToolboxUIPlugin.h | 1 - plugins/ExamplePlugin/ExamplePlugin.cpp | 5 +---- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/plugins/Base/ToolboxUIPlugin.cpp b/plugins/Base/ToolboxUIPlugin.cpp index 8db9c24b3..55f9a26f1 100644 --- a/plugins/Base/ToolboxUIPlugin.cpp +++ b/plugins/Base/ToolboxUIPlugin.cpp @@ -1,11 +1,9 @@ #include "ToolboxUIPlugin.h" #include -#include #include "GWCA/Utilities/Hook.h" #include -#include #include "PluginUtils.h" namespace { @@ -62,26 +60,18 @@ bool ToolboxUIPlugin::ShowInMainMenu() const void ToolboxUIPlugin::Initialize(ImGuiContext* ctx, const ImGuiAllocFns allocator_fns, const HMODULE toolbox_dll) { ToolboxPlugin::Initialize(ctx, allocator_fns, toolbox_dll); - GW::Initialize(); GW::Chat::CreateCommand(L"tb", CmdTB); } -bool ToolboxUIPlugin::CanTerminate() -{ - return GW::Hook::GetInHookCount() == 0; -} - void ToolboxUIPlugin::SignalTerminate() { ToolboxPlugin::SignalTerminate(); GW::Chat::DeleteCommand(L"tb"); - GW::DisableHooks(); } void ToolboxUIPlugin::Terminate() { ToolboxPlugin::Terminate(); - GW::Terminate(); } void ToolboxUIPlugin::DrawSettings() diff --git a/plugins/Base/ToolboxUIPlugin.h b/plugins/Base/ToolboxUIPlugin.h index 90576268a..eb17076f1 100644 --- a/plugins/Base/ToolboxUIPlugin.h +++ b/plugins/Base/ToolboxUIPlugin.h @@ -8,7 +8,6 @@ class ToolboxUIPlugin : public ToolboxPlugin { bool ShowInMainMenu() const override; void Initialize(ImGuiContext* ctx, ImGuiAllocFns allocator_fns, HMODULE toolbox_dll) override; - bool CanTerminate() override; void SignalTerminate() override; void Terminate() override; bool HasSettings() const override { return true; } diff --git a/plugins/ExamplePlugin/ExamplePlugin.cpp b/plugins/ExamplePlugin/ExamplePlugin.cpp index e5fb76499..609aac876 100644 --- a/plugins/ExamplePlugin/ExamplePlugin.cpp +++ b/plugins/ExamplePlugin/ExamplePlugin.cpp @@ -4,8 +4,6 @@ #include #include -#include -#include #include "GWCA/Managers/ChatMgr.h" namespace { @@ -52,11 +50,10 @@ void ExamplePlugin::SignalTerminate() { ToolboxUIPlugin::SignalTerminate(); GW::Chat::DeleteCommand(L"ee"); - GW::DisableHooks(); } bool ExamplePlugin::CanTerminate() { - return GW::Hook::GetInHookCount() == 0; + return true; } void ExamplePlugin::Draw(IDirect3DDevice9*)