diff --git a/Versions/build.txt b/Versions/build.txt
index 66510084e..454364d3b 100644
--- a/Versions/build.txt
+++ b/Versions/build.txt
@@ -1 +1 @@
-2625
+2626
diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf
index 5263c95b3..40bf3d80a 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3 BETA
diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp
index 057556594..ec6599f6e 100644
--- a/src/Config/Config.cpp
+++ b/src/Config/Config.cpp
@@ -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);
diff --git a/src/Notepad3.c b/src/Notepad3.c
index 44a278f83..83d9ff50c 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -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);
+ }
}
}
}
diff --git a/src/VersionEx.h b/src/VersionEx.h
index 0f0ed4712..3658ccff2 100644
--- a/src/VersionEx.h
+++ b/src/VersionEx.h
@@ -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