Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/treeview.c:
return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, hdr->idFrom, (LPARAM)hdr); }
+static INT +TREEVIEW_SendSafeNotify(const TREEVIEW_INFO *infoPtr, UINT code)
It seems better to me to separate the result of the sent notification from the result of IsWindow(). What about something like this? ``` static BOOL TREEVIEW_SendSimpleNotify(const TREEVIEW_INFO *infoPtr, UINT code, LRESULT *result) { NMHDR hdr; HWND hwnd; hwnd = infoPtr->hwnd; /* save hwnd before after TREEVIEW_SendRealNotify(), the window could be already destroyed after sending notifications */ *result = TREEVIEW_SendRealNotify(infoPtr, code, &hdr); return IsWindow(hwnd); } ``` Then, at places where TREEVIEW_SendSimpleNotify() is used. Check its return value before using the notification result. And if TREEVIEW_SendSimpleNotify() returns FALSE, then return from the message handler immediately. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8258#note_108193