Catch exception if DocumentDestroyer cannot lock the document to close it

This commit is contained in:
David Capello 2015-04-22 16:42:55 -03:00
parent 134dad8d5f
commit 073831472c

View File

@ -304,9 +304,10 @@ bool DocumentView::onCloseView(Workspace* workspace)
try_again = false;
}
try {
// Destroy the sprite (locking it as writer)
DocumentDestroyer destroyer(
static_cast<app::Context*>(m_document->context()), m_document, 250);
static_cast<app::Context*>(m_document->context()), m_document, 500);
StatusBar::instance()
->setStatusText(0, "Sprite '%s' closed.",
@ -315,9 +316,13 @@ bool DocumentView::onCloseView(Workspace* workspace)
destroyer.destroyDocument();
// At this point the view is already destroyed
return true;
}
catch (const LockedDocumentException& ex) {
Console::showException(ex);
return false;
}
}
void DocumentView::onTabPopup(Workspace* workspace)
{