Fixed two bugs when closing ScreenSpyDlg with file transfer dialogs:
1. Access violation (0xC0000005): CDlgFileSend self-destructs via
PostNcDestroy (delete this) when closed, leaving dangling pointers
in m_FileRecvDlgs map.
2. Double-free: Original code called DestroyWindow() then delete,
but DestroyWindow already triggers delete this via PostNcDestroy.
Solution:
- Store {HWND, pointer} pairs instead of raw pointers
- Check HWND validity with IsWindow() before accessing pointer
- Use SendMessage(WM_CLOSE) to let dialog self-destruct safely
- Always erase map entries to prevent accumulation of invalid data
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
112 KiB
112 KiB