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
@@ -12,10 +12,13 @@ public:
virtual void OnReceiveComplete();
void AppendLog(const std::string& text);
// 复用窗口(同一主机再次打开日志)时清空并重填整份快照
void ResetLog(const std::string& text);
protected:
virtual BOOL OnInitDialog();
virtual void DoDataExchange(CDataExchange* pDX);
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg LRESULT OnReportLog(WPARAM wParam, LPARAM lParam);