[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
This commit is contained in:
Don Ho 2014-12-11 01:19:47 +00:00
parent d2651832ea
commit 83acdc5423

View File

@ -4639,6 +4639,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
if (mask & BufferChangeStatus) if (mask & BufferChangeStatus)
{ //reload etc { //reload etc
bool didDialog = false; bool didDialog = false;
bool doCloseDoc = false;
switch(buffer->getStatus()) switch(buffer->getStatus())
{ {
case DOC_UNNAMED: //nothing todo 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 activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
didDialog = true; 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 //close in both views, doing current view last since that has to remain opened
bool isSnapshotMode = nppGUI.isSnapshotMode(); bool isSnapshotMode = nppGUI.isSnapshotMode();
@ -4701,6 +4703,9 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
::PostMessage(_pEditView->getHSelf(), SCI_SETSEL, curPos, curPos); ::PostMessage(_pEditView->getHSelf(), SCI_SETSEL, curPos, curPos);
if (::IsIconic(_pPublicInterface->getHSelf())) if (::IsIconic(_pPublicInterface->getHSelf()))
::ShowWindow(_pPublicInterface->getHSelf(), SW_RESTORE); ::ShowWindow(_pPublicInterface->getHSelf(), SW_RESTORE);
if (doCloseDoc) // buffer has been deleted, cannot (and no need to) go on
return;
} }
} }