diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index c8db820f3..7d4f89574 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -618,7 +618,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup) ((_mainWindowStatus & WindowSubActive) == WindowSubActive ? _subDocTab.nbItem() : 0); if (doDeleteBackup) - MainFileManager->deleteCurrentBufferBackup(); + MainFileManager->deleteBufferBackup(id); Buffer * buf = MainFileManager->getBufferByID(id); diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 797ceb499..60fa0d4f5 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -975,7 +975,7 @@ private: HANDLE _h; }; -bool FileManager::deleteCurrentBufferBackup() +bool FileManager::deleteBufferBackup(BufferID id) { HANDLE writeEvent = ::OpenEvent(EVENT_ALL_ACCESS, TRUE, TEXT("nppWrittingEvent")); if (!writeEvent) @@ -988,7 +988,7 @@ bool FileManager::deleteCurrentBufferBackup() if (::WaitForSingleObject(writeEvent, INFINITE) != WAIT_OBJECT_0) { // problem!!! - printStr(TEXT("WaitForSingleObject problem in deleteCurrentBufferBackup()!")); + printStr(TEXT("WaitForSingleObject problem in deleteBufferBackup()!")); return false; } @@ -998,7 +998,7 @@ bool FileManager::deleteCurrentBufferBackup() EventReset reset(writeEvent); // Will reset event in destructor. - Buffer* buffer = _pNotepadPlus->getCurrentBuffer(); + Buffer* buffer = getBufferByID(id); bool result = true; generic_string backupFilePath = buffer->getBackupFileName(); if (not backupFilePath.empty()) diff --git a/PowerEditor/src/ScitillaComponent/Buffer.h b/PowerEditor/src/ScitillaComponent/Buffer.h index c2a1145a1..f0a5cc7d0 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.h +++ b/PowerEditor/src/ScitillaComponent/Buffer.h @@ -102,7 +102,7 @@ public: bool reloadBufferDeferred(BufferID id); bool saveBuffer(BufferID id, const TCHAR* filename, bool isCopy = false, generic_string * error_msg = NULL); bool backupCurrentBuffer(); - bool deleteCurrentBufferBackup(); + bool deleteBufferBackup(BufferID id); bool deleteFile(BufferID id); bool moveFile(BufferID id, const TCHAR * newFilename); bool createEmptyFile(const TCHAR * path);