mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge pull request #1626 from RaiKoHoff/DevNewFeatures
Fix possible race condition on accessing configuration
This commit is contained in:
commit
a2d60563f4
@ -1 +1 @@
|
||||
2625
|
||||
2626
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.911.2625"
|
||||
version="5.19.912.2626"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 BETA</description>
|
||||
|
||||
@ -54,6 +54,7 @@ extern "C" int s_flagSingleFileInstance;
|
||||
extern "C" int s_flagMultiFileArg;
|
||||
extern "C" int s_flagShellUseSystemMRU;
|
||||
extern "C" int s_flagPrintFileAndLeave;
|
||||
extern "C" bool s_flagRelaunchElevated;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1187,7 +1188,7 @@ void LoadFlags()
|
||||
|
||||
bool SaveSettings(bool bSaveSettingsNow)
|
||||
{
|
||||
if (StrIsEmpty(Globals.IniFile) || !s_bEnableSaveSettings) { return false; }
|
||||
if (StrIsEmpty(Globals.IniFile) || !s_bEnableSaveSettings || s_flagRelaunchElevated) { return false; }
|
||||
|
||||
CreateIniFile();
|
||||
LoadIniFile(Globals.IniFile);
|
||||
|
||||
@ -92,6 +92,7 @@ int s_flagSingleFileInstance = 0;
|
||||
int s_flagMultiFileArg = 0;
|
||||
int s_flagShellUseSystemMRU = 0;
|
||||
int s_flagPrintFileAndLeave = 0;
|
||||
bool s_flagRelaunchElevated = false;
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
@ -556,7 +557,6 @@ static int s_flagMatchText = 0;
|
||||
static int s_flagChangeNotify = 0;
|
||||
static bool s_flagQuietCreate = false;
|
||||
static bool s_flagLexerSpecified = false;
|
||||
static bool s_flagRelaunchElevated = false;
|
||||
static bool s_flagAppIsClosing = false;
|
||||
static bool s_flagSearchPathIfRelative = false;
|
||||
static bool s_flagDisplayHelp = false;
|
||||
@ -10574,9 +10574,13 @@ void CALLBACK WatchTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
|
||||
// Check Change Notification Handle
|
||||
else if (WAIT_OBJECT_0 == WaitForSingleObject(s_hChangeHandle,0))
|
||||
{
|
||||
bool const bHasFileName = StrIsNotEmpty(Globals.CurrentFile);
|
||||
|
||||
// Check if the changes affect the current file
|
||||
WIN32_FIND_DATA fdUpdated;
|
||||
HANDLE hFind = FindFirstFile(Globals.CurrentFile,&fdUpdated);
|
||||
ZeroMemory(&fdUpdated, sizeof(WIN32_FIND_DATA));
|
||||
|
||||
HANDLE const hFind = bHasFileName ? FindFirstFile(Globals.CurrentFile, &fdUpdated) : INVALID_HANDLE_VALUE;
|
||||
if (INVALID_HANDLE_VALUE != hFind) {
|
||||
FindClose(hFind);
|
||||
}
|
||||
@ -10584,19 +10588,22 @@ void CALLBACK WatchTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
|
||||
// The current file has been removed
|
||||
ZeroMemory(&fdUpdated, sizeof(WIN32_FIND_DATA));
|
||||
}
|
||||
|
||||
// Check if the file has been changed
|
||||
if (CompareFileTime(&s_fdCurFile.ftLastWriteTime,&fdUpdated.ftLastWriteTime) != 0 ||
|
||||
s_fdCurFile.nFileSizeLow != fdUpdated.nFileSizeLow ||
|
||||
s_fdCurFile.nFileSizeHigh != fdUpdated.nFileSizeHigh ||
|
||||
FileWatching.MonitoringLog /* force */)
|
||||
{
|
||||
// Shutdown current watching and give control to main window
|
||||
_TerminateFileWatching();
|
||||
//SendMessage(Globals.hwndMain,WM_CHANGENOTIFY,0,0);
|
||||
MsgChangeNotify(Globals.hwndMain, (WPARAM)NULL, (LPARAM)NULL);
|
||||
}
|
||||
else {
|
||||
FindNextChangeNotification(s_hChangeHandle);
|
||||
if (bHasFileName) {
|
||||
if (CompareFileTime(&s_fdCurFile.ftLastWriteTime, &fdUpdated.ftLastWriteTime) != 0 ||
|
||||
s_fdCurFile.nFileSizeLow != fdUpdated.nFileSizeLow ||
|
||||
s_fdCurFile.nFileSizeHigh != fdUpdated.nFileSizeHigh ||
|
||||
FileWatching.MonitoringLog /* force */)
|
||||
{
|
||||
// Shutdown current watching and give control to main window
|
||||
_TerminateFileWatching();
|
||||
//SendMessage(Globals.hwndMain,WM_CHANGENOTIFY,0,0);
|
||||
MsgChangeNotify(Globals.hwndMain, (WPARAM)NULL, (LPARAM)NULL);
|
||||
}
|
||||
else {
|
||||
FindNextChangeNotification(s_hChangeHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#define SAPPNAME "Notepad3"
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_REV 911
|
||||
#define VERSION_BUILD 2625
|
||||
#define VERSION_REV 912
|
||||
#define VERSION_BUILD 2626
|
||||
#define SCINTILLA_VER 420
|
||||
#define ONIGURUMA_REGEX_VER 6.9.3
|
||||
#define UCHARDET_VER 2018.09.27
|
||||
|
||||
Loading…
Reference in New Issue
Block a user