Fix: let the client log window close and reuse itself

CClientLog was the only sub-connection dialog without ON_WM_CLOSE, so
the close button did nothing and the window stayed until the master
exited. It now wires WM_CLOSE like the other dialogs: it detaches the
context's dialog pointer and cancels the log sub-connection before
destroying, so the client's three-second log push loop stops instead of
posting increments to a destroyed window.

Every menu click also opened a new dialog and a new log sub-connection:
the client starts one per COMMAND_QUERY_LOG, and each arrives on a new
context whose hDlg is empty, so the existing "append to open dialog"
path never matched. The master now keeps one log window per client id;
a repeat request closes the previous sub-connection, rebinds the window
to the new one and refreshes the snapshot instead of opening another.

Verified on the Debug server: WM_CLOSE destroys the window, two extra
clicks keep a single window, and the main connection stays online.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-30 13:30:58 +01:00
1 parent 381a7f85a0
commit f1315a8790
4 files changed
+71 -3

No files matched your search

+3
View File
@@ -510,6 +510,9 @@ public:
CBitmap m_bmCompressZlib; // 实验功能→线缆压缩:ZLIB
uint64_t m_superID;
std::map<HWND, CDialogBase *> m_RemoteWnds;
// 每台主机只保留一个客户端运行日志窗口:clientID -> 窗口句柄。
// 窗口关掉后这里可能留下失效句柄,下次打开时会用 IsWindow/ClientID 校验并清理。
std::map<uint64_t, HWND> m_LogDlgWindows;
FileTransformCmd m_CmdList;
CDialogBase* GetRemoteWindow(HWND hWnd);
CDialogBase* GetRemoteWindow(CDialogBase* dlg);