Fix wrong backup file deleted isuue
On doClose() delete the right backup file Fix #4744, close #4745
This commit is contained in:
parent
4969f377ad
commit
b48c086831
@ -618,7 +618,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
|
|||||||
((_mainWindowStatus & WindowSubActive) == WindowSubActive ? _subDocTab.nbItem() : 0);
|
((_mainWindowStatus & WindowSubActive) == WindowSubActive ? _subDocTab.nbItem() : 0);
|
||||||
|
|
||||||
if (doDeleteBackup)
|
if (doDeleteBackup)
|
||||||
MainFileManager->deleteCurrentBufferBackup();
|
MainFileManager->deleteBufferBackup(id);
|
||||||
|
|
||||||
Buffer * buf = MainFileManager->getBufferByID(id);
|
Buffer * buf = MainFileManager->getBufferByID(id);
|
||||||
|
|
||||||
|
@ -975,7 +975,7 @@ private:
|
|||||||
HANDLE _h;
|
HANDLE _h;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool FileManager::deleteCurrentBufferBackup()
|
bool FileManager::deleteBufferBackup(BufferID id)
|
||||||
{
|
{
|
||||||
HANDLE writeEvent = ::OpenEvent(EVENT_ALL_ACCESS, TRUE, TEXT("nppWrittingEvent"));
|
HANDLE writeEvent = ::OpenEvent(EVENT_ALL_ACCESS, TRUE, TEXT("nppWrittingEvent"));
|
||||||
if (!writeEvent)
|
if (!writeEvent)
|
||||||
@ -988,7 +988,7 @@ bool FileManager::deleteCurrentBufferBackup()
|
|||||||
if (::WaitForSingleObject(writeEvent, INFINITE) != WAIT_OBJECT_0)
|
if (::WaitForSingleObject(writeEvent, INFINITE) != WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
// problem!!!
|
// problem!!!
|
||||||
printStr(TEXT("WaitForSingleObject problem in deleteCurrentBufferBackup()!"));
|
printStr(TEXT("WaitForSingleObject problem in deleteBufferBackup()!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,7 +998,7 @@ bool FileManager::deleteCurrentBufferBackup()
|
|||||||
|
|
||||||
EventReset reset(writeEvent); // Will reset event in destructor.
|
EventReset reset(writeEvent); // Will reset event in destructor.
|
||||||
|
|
||||||
Buffer* buffer = _pNotepadPlus->getCurrentBuffer();
|
Buffer* buffer = getBufferByID(id);
|
||||||
bool result = true;
|
bool result = true;
|
||||||
generic_string backupFilePath = buffer->getBackupFileName();
|
generic_string backupFilePath = buffer->getBackupFileName();
|
||||||
if (not backupFilePath.empty())
|
if (not backupFilePath.empty())
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
bool reloadBufferDeferred(BufferID id);
|
bool reloadBufferDeferred(BufferID id);
|
||||||
bool saveBuffer(BufferID id, const TCHAR* filename, bool isCopy = false, generic_string * error_msg = NULL);
|
bool saveBuffer(BufferID id, const TCHAR* filename, bool isCopy = false, generic_string * error_msg = NULL);
|
||||||
bool backupCurrentBuffer();
|
bool backupCurrentBuffer();
|
||||||
bool deleteCurrentBufferBackup();
|
bool deleteBufferBackup(BufferID id);
|
||||||
bool deleteFile(BufferID id);
|
bool deleteFile(BufferID id);
|
||||||
bool moveFile(BufferID id, const TCHAR * newFilename);
|
bool moveFile(BufferID id, const TCHAR * newFilename);
|
||||||
bool createEmptyFile(const TCHAR * path);
|
bool createEmptyFile(const TCHAR * path);
|
||||||
|
Loading…
Reference in New Issue
Block a user