[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)
{ //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;
}
}