mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
Fix crash on closing all documents (#666)
* editor does not crash on close all documents * unused import Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
359687f478
commit
e623f7cc41
1 changed files with 9 additions and 2 deletions
|
|
@ -171,8 +171,15 @@ impl MessageHandler<PortfolioMessage, &InputPreprocessorMessageHandler> for Port
|
|||
self.documents.clear();
|
||||
self.document_ids.clear();
|
||||
|
||||
// Create a new blank document
|
||||
responses.push_back(NewDocument.into());
|
||||
// Clear out all documents and make a new default document
|
||||
let new_document_id = generate_uuid();
|
||||
self.documents.insert(new_document_id, DocumentMessageHandler::default());
|
||||
self.document_ids.push(new_document_id);
|
||||
self.active_document_id = new_document_id;
|
||||
|
||||
responses.push_back(ToolMessage::AbortCurrentTool.into());
|
||||
responses.push_back(PortfolioMessage::UpdateOpenDocumentsList.into());
|
||||
responses.push_back(PortfolioMessage::SelectDocument { document_id: new_document_id }.into())
|
||||
}
|
||||
CloseDocument { document_id } => {
|
||||
let document_index = self.document_index(document_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue