Fix: keep the preview hash timer for mismatched responses
Only consume a TOKEN_FILE_HASH response whose echoed path matches the pending request, and kill the 5 s timer only in that branch. A late, duplicate or malformed response previously killed the timer but left m_pendingHash set, so every later double-click in that window was rejected as "another preview is in progress" until the dialog closed. A mismatched response is now ignored and the timer still falls back to the size/mtime path, which clears the pending state. Co-Authored-By: deepseek-flash
This commit was merged in pull request #10.
This commit is contained in:
1 parent
bcd7ee692a
commit
ee20326bbf
1 file changed
+5
-5
@@ -1466,11 +1466,12 @@ LRESULT CFileManagerDlg::OnPreviewHashResult(WPARAM /*wParam*/, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
FilePreviewHashResult* r = (FilePreviewHashResult*)lParam;
|
FilePreviewHashResult* r = (FilePreviewHashResult*)lParam;
|
||||||
if (!r) return 0;
|
if (!r) return 0;
|
||||||
KillTimer(kPreviewHashTimer);
|
|
||||||
|
|
||||||
if (!m_pendingHash.fullPath.IsEmpty()) {
|
// 只消费匹配当前 pending 路径的响应。迟到/重复/异常响应不能杀定时器,
|
||||||
std::string expected((LPCSTR)m_pendingHash.fullPath);
|
// 否则 m_pendingHash 会一直非空、而超时兜底已失效,窗口再也无法发起预览。
|
||||||
if (r->path == expected) {
|
if (!m_pendingHash.fullPath.IsEmpty() &&
|
||||||
|
r->path == std::string((LPCSTR)m_pendingHash.fullPath)) {
|
||||||
|
KillTimer(kPreviewHashTimer);
|
||||||
CString full = m_pendingHash.fullPath;
|
CString full = m_pendingHash.fullPath;
|
||||||
uint64_t size = m_pendingHash.size;
|
uint64_t size = m_pendingHash.size;
|
||||||
uint64_t mtime = m_pendingHash.mtimeMs;
|
uint64_t mtime = m_pendingHash.mtimeMs;
|
||||||
@@ -1497,7 +1498,6 @@ LRESULT CFileManagerDlg::OnPreviewHashResult(WPARAM /*wParam*/, LPARAM lParam)
|
|||||||
ContinueRemotePreview(full, size, mtime, std::string());
|
ContinueRemotePreview(full, size, mtime, std::string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
delete r;
|
delete r;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user