mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Fix crash using Sprite:close() Lua API on modified sprites (fix #2142)
This commit is contained in:
parent
23b6e1d118
commit
eb2e0e52dc
@ -98,10 +98,16 @@ void BackupObserver::onRemoveDocument(Doc* doc)
|
|||||||
base::remove_from_container(m_documents, doc);
|
base::remove_from_container(m_documents, doc);
|
||||||
}
|
}
|
||||||
if (m_config->keepEditedSpriteDataFor > 0 &&
|
if (m_config->keepEditedSpriteDataFor > 0 &&
|
||||||
doc->needsBackup())
|
doc->needsBackup() &&
|
||||||
|
// If the backup is disabled, we don't need it (e.g. when the
|
||||||
|
// document is destroyed from a script with Sprite:close(), the
|
||||||
|
// backup is disabled)
|
||||||
|
!doc->inhibitBackup()) {
|
||||||
m_closedDocs.push_back(doc);
|
m_closedDocs.push_back(doc);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
m_session->removeDocument(doc);
|
m_session->removeDocument(doc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackupObserver::backgroundThread()
|
void BackupObserver::backgroundThread()
|
||||||
|
@ -184,6 +184,12 @@ namespace app {
|
|||||||
void destroyDocument() {
|
void destroyDocument() {
|
||||||
ASSERT(m_doc != nullptr);
|
ASSERT(m_doc != nullptr);
|
||||||
|
|
||||||
|
// Don't create a backup for destroyed documents (e.g. documents
|
||||||
|
// are destroyed when they are used internally by Aseprite or by
|
||||||
|
// a script and then closed with Sprite:close())
|
||||||
|
if (m_doc->needsBackup())
|
||||||
|
m_doc->setInhibitBackup(true);
|
||||||
|
|
||||||
m_doc->close();
|
m_doc->close();
|
||||||
Doc* doc = m_doc;
|
Doc* doc = m_doc;
|
||||||
unlock();
|
unlock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user