Skip to content

Commit

Permalink
fix crash unloading plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Dec 17, 2024
1 parent 1776e12 commit 5523bc4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
10 changes: 0 additions & 10 deletions plugins/Base/ToolboxUIPlugin.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "ToolboxUIPlugin.h"
#include <imgui.h>

#include <GWCA/Utilities/Hooker.h>
#include "GWCA/Utilities/Hook.h"
#include <GWCA/Managers/ChatMgr.h>

#include <GWCA/GWCA.h>
#include "PluginUtils.h"

namespace {
Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion plugins/Base/ToolboxUIPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
5 changes: 1 addition & 4 deletions plugins/ExamplePlugin/ExamplePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <GWCA/Managers/MapMgr.h>

#include <Utils/GuiUtils.h>
#include <GWCA/GWCA.h>
#include <GWCA/Utilities/Hooker.h>
#include "GWCA/Managers/ChatMgr.h"

namespace {
Expand Down Expand Up @@ -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*)
Expand Down

0 comments on commit 5523bc4

Please sign in to comment.