diff options
author | Neil <nyamatongwe@gmail.com> | 2021-05-07 23:25:56 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-05-07 23:25:56 +1000 |
commit | 8827755d994e9ebb49097da51a4e460c56385774 (patch) | |
tree | d930b836de6b4fe60be2f061cee2d491db58d00c /src/EditView.h | |
parent | 7d47304ca36474000293f267dda39483113c86e3 (diff) | |
download | scintilla-mirror-8827755d994e9ebb49097da51a4e460c56385774.tar.gz |
Use shared_ptr for LineLayoutCache as it simpifies lifetime management.
AutoLineLayout and other code no longer needed so removed.
Diffstat (limited to 'src/EditView.h')
-rw-r--r-- | src/EditView.h | 30 |
1 files changed, 1 insertions, 29 deletions
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<LineLayout> 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 |