From 83acdc5423c217063fd9b64bd5d37d62301b5e53 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 11 Dec 2014 01:19:47 +0000 Subject: [PATCH] [BUG_FIXED] Fix a crash issue while the opened document is deleted/moved from outside. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1305 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 93dd6dc9..32b5db8f 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4639,6 +4639,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) if (mask & BufferChangeStatus) { //reload etc bool didDialog = false; + bool doCloseDoc = false; switch(buffer->getStatus()) { case DOC_UNNAMED: //nothing todo @@ -4683,7 +4684,8 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible didDialog = true; - if (doCloseOrNot(buffer->getFullPathName()) == IDNO) + doCloseDoc = doCloseOrNot(buffer->getFullPathName()) == IDNO; + if (doCloseDoc) { //close in both views, doing current view last since that has to remain opened bool isSnapshotMode = nppGUI.isSnapshotMode(); @@ -4701,6 +4703,9 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) ::PostMessage(_pEditView->getHSelf(), SCI_SETSEL, curPos, curPos); if (::IsIconic(_pPublicInterface->getHSelf())) ::ShowWindow(_pPublicInterface->getHSelf(), SW_RESTORE); + + if (doCloseDoc) // buffer has been deleted, cannot (and no need to) go on + return; } }