From cb1172e2a4581732a82fdc9ec35aac0fa9a357a1 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 19 Dec 2024 15:55:29 +0100 Subject: [PATCH] Enhabnce updateTimeStamp fuction Follow the disscussion: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/15936#discussion_r1886067242 Close #15968 --- PowerEditor/src/ScintillaComponent/Buffer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index 4d4428d7e9b8..c6fc8d901e8b 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -169,6 +169,7 @@ void Buffer::updateTimeStamp() msg += "TRUE"; else msg += "FALSE"; + if (bWorkerThreadTerminated) { msg += ", its worker thread had to be forcefully terminated due to timeout reached!"; @@ -184,9 +185,13 @@ void Buffer::updateTimeStamp() writeLog(nppIssueLog.c_str(), msg.c_str()); } } + + // if getting timestamp operation fails, no timestamp to compare then no need to continue + return; } LONG res = CompareFileTime(&_timeStamp, &timeStampLive); + if (res == -1 || res == 1) // (res == -1) => timeStampLive is later, it means the file has been modified outside of Notepad++ - usual case //