diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/PlatWin.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
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; } |