From 565242584f144ff4e7ce425f7548a185d6f23f62 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Tue, 18 Sep 2012 11:45:33 +0200 Subject: [PATCH] Ensure document stays open in refresh helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Frameworks/OakTextView/src/OakTextView.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Frameworks/OakTextView/src/OakTextView.mm b/Frameworks/OakTextView/src/OakTextView.mm index 67f54746..78359ed9 100644 --- a/Frameworks/OakTextView/src/OakTextView.mm +++ b/Frameworks/OakTextView/src/OakTextView.mm @@ -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(); } }