diff options
author | Neil <nyamatongwe@gmail.com> | 2018-07-31 09:07:31 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-07-31 09:07:31 +1000 |
commit | 22b8ec313314be239a04741669fa3e7a19f8288e (patch) | |
tree | 9a45a66765c786b0375f8e2634d4da7e69417d48 | |
parent | bdfac6f2fd012ca71d0062d8c5390cc8dd06f81c (diff) | |
download | scintilla-mirror-22b8ec313314be239a04741669fa3e7a19f8288e.tar.gz |
Change lifetime of textLayout for bidirectional so it is always released in
ScreenLineLayout destructor. Allows multiple ScreenLineLayout calls and fixes a
leak when only FindRangeIntervals called.
-rw-r--r-- | doc/ScintillaHistory.html | 3 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index a6e618e82..18179c735 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -568,6 +568,9 @@ Cursor no longer flickers in edit and combo boxes. Focus in and out events occur for combo boxes. </li> + <li> + Fix a leak in the bidirectional code on Win32. + </li> </ul> <h3> <a href="https://www.scintilla.org/scite410.zip">Release 4.1.0</a> diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 9e03dec16..222eac26b 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1844,6 +1844,10 @@ ScreenLineLayout::ScreenLineLayout(const IScreenLine *screenLine) { } ScreenLineLayout::~ScreenLineLayout() { + if (textLayout) { + textLayout->Release(); + textLayout = nullptr; + } } // Get the position from the provided x @@ -1888,7 +1892,6 @@ size_t ScreenLineLayout::PositionFromX(XYPOSITION xDistance, bool charPosition) ); } - textLayout->Release(); size_t pos; if (charPosition) { pos = isTrailingHit ? hitTestMetrics.textPosition : caretMetrics.textPosition; @@ -1921,8 +1924,6 @@ XYPOSITION ScreenLineLayout::XFromPosition(size_t caretPosition) { &caretMetrics ); - textLayout->Release(); - return pt.x; } |