CtrlDisplayListView: Zero the window ptr, do the delete.

See #18510
This commit is contained in:
Henrik Rydgård 2023-12-28 10:44:08 +01:00
parent 822ebf9dfb
commit 49ff1af16a

View File

@ -77,8 +77,7 @@ LRESULT CALLBACK CtrlDisplayListView::wndProc(HWND hwnd, UINT msg, WPARAM wParam
{ {
CtrlDisplayListView *win = CtrlDisplayListView::getFrom(hwnd); CtrlDisplayListView *win = CtrlDisplayListView::getFrom(hwnd);
switch(msg) switch(msg) {
{
case WM_NCCREATE: case WM_NCCREATE:
// Allocate a new CustCtrl structure for this window. // Allocate a new CustCtrl structure for this window.
win = new CtrlDisplayListView(hwnd); win = new CtrlDisplayListView(hwnd);
@ -86,6 +85,8 @@ LRESULT CALLBACK CtrlDisplayListView::wndProc(HWND hwnd, UINT msg, WPARAM wParam
// Continue with window creation. // Continue with window creation.
return win != NULL; return win != NULL;
case WM_NCDESTROY: case WM_NCDESTROY:
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
delete win;
break; break;
case WM_SIZE: case WM_SIZE:
win->redraw(); win->redraw();