From 8827755d994e9ebb49097da51a4e460c56385774 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 7 May 2021 23:25:56 +1000 Subject: Use shared_ptr for LineLayoutCache as it simpifies lifetime management. AutoLineLayout and other code no longer needed so removed. --- src/EditView.h | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/EditView.h') diff --git a/src/EditView.h b/src/EditView.h index cf500e06f..bea42cbe9 100644 --- a/src/EditView.h +++ b/src/EditView.h @@ -113,7 +113,7 @@ public: void DropGraphics() noexcept; void RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw); - LineLayout *RetrieveLineLayout(Sci::Line lineNumber, const EditModel &model); + std::shared_ptr RetrieveLineLayout(Sci::Line lineNumber, const EditModel &model); void LayoutLine(const EditModel &model, Surface *surface, const ViewStyle &vstyle, LineLayout *ll, int width = LineLayout::wrapWidthInfinite); @@ -158,34 +158,6 @@ public: const EditModel &model, const ViewStyle &vs); }; -/** -* Convenience class to ensure LineLayout objects are always disposed. -*/ -class AutoLineLayout { - LineLayoutCache &llc; - LineLayout *ll; -public: - AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) noexcept : llc(llc_), ll(ll_) {} - AutoLineLayout(const AutoLineLayout &) = delete; - AutoLineLayout(AutoLineLayout &&) = delete; - AutoLineLayout &operator=(const AutoLineLayout &) = delete; - AutoLineLayout &operator=(AutoLineLayout &&) = delete; - ~AutoLineLayout() noexcept { - llc.Dispose(ll); - ll = nullptr; - } - LineLayout *operator->() const noexcept { - return ll; - } - operator LineLayout *() const noexcept { - return ll; - } - void Set(LineLayout *ll_) noexcept { - llc.Dispose(ll); - ll = ll_; - } -}; - } #endif -- cgit v1.2.3