From 2542eb02648294256a01ae4ecb6ac81bc8ab5094 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 16 Nov 2014 23:46:08 +0100 Subject: Make sure QRegister::view is properly initialized and cleaned up * it must be initialized after the UI (Interface::main), so I added a View::initialize() function * the old initialize() method was renamed to setup() * use a global instance of QRegister::view so it is guaranteed to be destroyed only after any QRegisters that could still need it * Document API adapted to work with ViewCurrent references --- src/document.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/document.h') diff --git a/src/document.h b/src/document.h index 763db7a..686d2f4 100644 --- a/src/document.h +++ b/src/document.h @@ -67,10 +67,10 @@ public: return doc != NULL; } - void edit(ViewCurrent *view); - void undo_edit(ViewCurrent *view); + void edit(ViewCurrent &view); + void undo_edit(ViewCurrent &view); - void update(ViewCurrent *view); + void update(ViewCurrent &view); inline void update(const Document &from) { @@ -108,8 +108,8 @@ protected: release_document(void) { if (is_initialized()) { - ViewCurrent *view = get_create_document_view(); - view->ssm(SCI_RELEASEDOCUMENT, 0, (sptr_t)doc); + ViewCurrent &view = get_create_document_view(); + view.ssm(SCI_RELEASEDOCUMENT, 0, (sptr_t)doc); doc = NULL; } } @@ -123,14 +123,14 @@ private: * per document, it must instead be returned by * this method. */ - virtual ViewCurrent *get_create_document_view(void) = 0; + virtual ViewCurrent &get_create_document_view(void) = 0; inline void maybe_create_document(void) { if (!is_initialized()) { - ViewCurrent *view = get_create_document_view(); - doc = (SciDoc)view->ssm(SCI_CREATEDOCUMENT); + ViewCurrent &view = get_create_document_view(); + doc = (SciDoc)view.ssm(SCI_CREATEDOCUMENT); } } }; -- cgit v1.2.3