mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-18 11:42:47 +00:00
Catch exception if DocumentDestroyer cannot lock the document to close it
This commit is contained in:
parent
134dad8d5f
commit
073831472c
@ -304,9 +304,10 @@ bool DocumentView::onCloseView(Workspace* workspace)
|
|||||||
try_again = false;
|
try_again = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// Destroy the sprite (locking it as writer)
|
// Destroy the sprite (locking it as writer)
|
||||||
DocumentDestroyer destroyer(
|
DocumentDestroyer destroyer(
|
||||||
static_cast<app::Context*>(m_document->context()), m_document, 250);
|
static_cast<app::Context*>(m_document->context()), m_document, 500);
|
||||||
|
|
||||||
StatusBar::instance()
|
StatusBar::instance()
|
||||||
->setStatusText(0, "Sprite '%s' closed.",
|
->setStatusText(0, "Sprite '%s' closed.",
|
||||||
@ -315,9 +316,13 @@ bool DocumentView::onCloseView(Workspace* workspace)
|
|||||||
destroyer.destroyDocument();
|
destroyer.destroyDocument();
|
||||||
|
|
||||||
// At this point the view is already destroyed
|
// At this point the view is already destroyed
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
catch (const LockedDocumentException& ex) {
|
||||||
|
Console::showException(ex);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DocumentView::onTabPopup(Workspace* workspace)
|
void DocumentView::onTabPopup(Workspace* workspace)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user