From fa4eaa3d572a9bb2bebbf9da15c7e8445a10dfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 14 Jul 2022 13:27:06 +0200 Subject: Pass WM_DESTROY to ListView::WndProc. On WM_DESTROY, the "this" property was removed before it could be retrieved and dereferenced, making it impossible for WM_DESTROY messages to be passed to the WndProc method. --- c/listview.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'c') diff --git a/c/listview.cpp b/c/listview.cpp index b375454..f38b952 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -96,12 +96,10 @@ ListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) { - case WM_DESTROY: + ListView *lpLv = (ListView *)GetProp(hWnd, TEXT("this")); + + if (uMsg == WM_DESTROY) RemoveProp(hWnd, TEXT("this")); - break; - } - ListView *lpLv = (ListView *)GetProp(hWnd, TEXT("this")); return lpLv? lpLv->WndProc(hWnd, uMsg, wParam, lParam): FALSE; } -- cgit v1.2.3