Windows: free more allocated memory before exit

This gets rid of the final leak complaint on Windows as of Nov 13, 2024
This commit is contained in:
nhmall
2024-11-13 13:48:50 -05:00
parent c85b5d3e56
commit fa9210aa65
11 changed files with 57 additions and 15 deletions

View File

@@ -171,6 +171,7 @@ NHMessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
data = (PNHMessageWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
free(data);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) 0);
windowdata[NHW_MESSAGE].address = 0;
} break;
case WM_SIZE: {
@@ -729,6 +730,7 @@ onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
ZeroMemory(data, sizeof(NHMessageWindow));
data->max_text = MAXWINDOWTEXT;
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data);
windowdata[NHW_MESSAGE].address = (genericptr_t) data; // for cleanup at the end
/* re-calculate window size (+ font size) */
mswin_message_window_size(hWnd, &dummy);