Nikolay Sivov (@nsivov) commented about dlls/comctl32/treeview.c:
TREEVIEW_SendSimpleNotify(const TREEVIEW_INFO *infoPtr, UINT code) { NMHDR hdr; - return TREEVIEW_SendRealNotify(infoPtr, code, &hdr); + BOOL result = TREEVIEW_SendRealNotify(infoPtr, code, &hdr); + + if(!IsWindow(infoPtr->hwnd)) + result = TRUE; + return result; } As unfortunate as it looks, it might be close to what we need. However there are two problems with it. First, easy to fix, you're accessing potentially freed "infoPtr". Second is a bit worse - all notifications go through this helper, so we can't really use control data after returning from it because it could have been destroyed. Returning TRUE from TVN_ENDLABELEDITW for example will go through "save text" path, with newly added check too.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/8258#note_105930