Ensure document stays open in refresh helper

The refresh helper uses the document’s undo manager in its destructor. Normally the document would stay open throughout the duration of the scope in which the refresh helper is used, but it might be possible to close the current document from a nested event loop, as spawned e.g. by showing a tool tip, in which case, the document will be closed when we reach the destructor.
This commit is contained in:
Allan Odgaard
2012-09-18 11:45:33 +02:00
parent 2ef3d52a3d
commit 565242584f

View File

@@ -119,6 +119,8 @@ struct refresh_helper_t
{
if(++_self.refreshNestCount == 1)
{
_document->open();
_revision = document->buffer().revision();
_selection = editor->ranges();
_document->undo_manager().begin_undo_group(_editor->ranges());
@@ -194,6 +196,8 @@ struct refresh_helper_t
[_self updateChoiceMenu:nil];
}
}
_document->close();
}
}