From 12f6ca53a028a72028b345e6fb3d181c47b66105 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Sun, 25 May 2025 10:14:33 +1000 Subject: Feature [feature-requests:#1557]. Simplify LineLayout deallocation. --- src/PositionCache.cxx | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/PositionCache.cxx') diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index ed3a08270..1f3a803fc 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -81,23 +81,17 @@ LineLayout::LineLayout(Sci::Line lineNumber_, int maxLineLength_) : Resize(maxLineLength_); } -LineLayout::~LineLayout() { - Free(); -} - void LineLayout::Resize(int maxLineLength_) { if (maxLineLength_ > maxLineLength) { - Free(); const size_t lineAllocation = maxLineLength_ + 1; chars = std::make_unique(lineAllocation); styles = std::make_unique(lineAllocation); // Extra position allocated as sometimes the Windows // GetTextExtentExPoint API writes an extra element. positions = std::make_unique(lineAllocation + 1); - if (bidiData) { - bidiData->Resize(maxLineLength_); - } - + lineStarts.reset(); + bidiData.reset(); + lenLineStarts = 0; maxLineLength = maxLineLength_; } } @@ -116,15 +110,6 @@ void LineLayout::EnsureBidiData() { } } -void LineLayout::Free() noexcept { - chars.reset(); - styles.reset(); - positions.reset(); - lineStarts.reset(); - lenLineStarts = 0; - bidiData.reset(); -} - void LineLayout::ClearPositions() { std::fill(&positions[0], &positions[maxLineLength + 2], 0.0f); } -- cgit v1.2.3