![]() |
#1 |
Prophet
Join Date: Apr 2008
Posts: 2,967
![]() |
A little bugfix for Windows users not using Win client...
As I discovered when using SDL and GCU clients on Windows, the "quit" hook is not called when closing the console (resulting in a lot of memory not being freed) because the CTRL_CLOSE_EVENT is not handled.
The code below fixes that problem nicely. Declare a control handler function in the main-xxx file: Code:
static BOOL CtrlHandler(DWORD fdwCtrlType) { switch (fdwCtrlType) { case CTRL_CLOSE_EVENT: quit(NULL); return FALSE; default: return FALSE; } } Code:
/* Activate hooks */ plog_aux = hook_plog; quit_aux = hook_quit; /* Register a control handler */ if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE)) quit("Could not set control handler");
__________________
PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant! |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fixing dir, shift-dir and ctrl-dir keys part 1: Win client | PowerWyrm | Development | 14 | June 4, 2012 15:30 |
[3.4-dev] Minor bugs with Win client | PowerWyrm | Development | 0 | April 18, 2012 13:17 |
Quickband bugfix release | Antoine | Variants | 4 | July 28, 2011 02:46 |
Bugfix release for 3.2? | Timo Pietilä | Development | 69 | April 14, 2011 20:59 |
Any non-Windows users in competition? | chem | Competition | 5 | January 8, 2009 11:57 |