Fix repeated requests of reloading from disk
A popuped message appear for the 1st modification from outside of Notepad++, if users ignore it and save another change outside, the 2nd popuped message appears. This commit fix this bad behaviour, which could lead crash. Closes #3307
This commit is contained in:
parent
71ffe870c5
commit
85216fe577
|
@ -250,7 +250,12 @@ bool Buffer::checkFileState() //eturns true if the status has been changed (it c
|
||||||
|
|
||||||
_currentStatus = DOC_MODIFIED;
|
_currentStatus = DOC_MODIFIED;
|
||||||
_timeStamp = buf.st_mtime;
|
_timeStamp = buf.st_mtime;
|
||||||
doNotify(BufferChangeStatus | BufferChangeReadonly | BufferChangeTimestamp);
|
|
||||||
|
if (_reloadFromDiskRequestGuard.try_lock())
|
||||||
|
{
|
||||||
|
doNotify(BufferChangeStatus | BufferChangeReadonly | BufferChangeTimestamp);
|
||||||
|
_reloadFromDiskRequestGuard.unlock();
|
||||||
|
}
|
||||||
isOK = true;
|
isOK = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,10 +278,17 @@ bool Buffer::checkFileState() //eturns true if the status has been changed (it c
|
||||||
|
|
||||||
if (mask != 0)
|
if (mask != 0)
|
||||||
{
|
{
|
||||||
doNotify(mask);
|
if (_reloadFromDiskRequestGuard.try_lock())
|
||||||
isOK = true;
|
{
|
||||||
|
doNotify(mask);
|
||||||
|
|
||||||
|
_reloadFromDiskRequestGuard.unlock();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
isOK = false;
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWow64Off)
|
if (isWow64Off)
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include "Utf8_16.h"
|
#include "Utf8_16.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -413,4 +415,6 @@ private:
|
||||||
bool _hasLangBeenSetFromMenu = false;
|
bool _hasLangBeenSetFromMenu = false;
|
||||||
|
|
||||||
MapPosition _mapPosition;
|
MapPosition _mapPosition;
|
||||||
|
|
||||||
|
std::mutex _reloadFromDiskRequestGuard;
|
||||||
};
|
};
|
Loading…
Reference in New Issue