Skip to content

Commit

Permalink
only send closing to gw once toolbox has actually exited
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed May 1, 2024
1 parent 0ac842f commit b6b2f01
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions GWToolboxdll/GWToolbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace {

// Left button clicked, on the exit button (ID 0x3)
if (!closing_gw) {
SendMessage(GW::MemoryMgr::GetGWWindowHandle(), WM_CLOSE, NULL, NULL);
SendMessage(gw_window_handle, WM_CLOSE, NULL, NULL);
}
closing_gw = true;
GW::Hook::LeaveHook();
Expand Down Expand Up @@ -444,6 +444,11 @@ DWORD __stdcall ThreadEntry(LPVOID)

Log::Log("Closing log/console, bye!\n");
Log::Terminate();

if (defer_close) {
// Toolbox was closed by a user closing GW - close it here for the by sending the `WM_CLOSE` message again.
SendMessage(gw_window_handle, WM_CLOSE, NULL, NULL);
}
return 0;
}

Expand Down Expand Up @@ -928,11 +933,6 @@ void GWToolbox::UpdateTerminating(float delta_f) {
GW::DisableHooks();

gwtoolbox_state = GWToolboxState::Terminated;

if (defer_close) {
// Toolbox was closed by a user closing GW - close it here for the by sending the `WM_CLOSE` message again.
SendMessageW(gw_window_handle, WM_CLOSE, NULL, NULL);
}
}

void GWToolbox::DrawTerminating(IDirect3DDevice9*) {
Expand Down

0 comments on commit b6b2f01

Please sign in to comment.