aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-03-29 18:03:57 +1100
committerNeil <nyamatongwe@gmail.com>2025-03-29 18:03:57 +1100
commit581870605c7079dac66f847135704c0b44b32c63 (patch)
tree12c90ccfd8f298c269a06759d7a875b243bd6456
parentbe86b31a7085c1ed73ee34e3e25ebb1458064e8c (diff)
downloadscintilla-mirror-581870605c7079dac66f847135704c0b44b32c63.tar.gz
Reorder fields to ensure textLayout destroyed before blobs which it depends on.
Otherwise there may be a crash inside DirectWrite.
-rw-r--r--win32/SurfaceD2D.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/win32/SurfaceD2D.cxx b/win32/SurfaceD2D.cxx
index 0a3385a5b..492e34349 100644
--- a/win32/SurfaceD2D.cxx
+++ b/win32/SurfaceD2D.cxx
@@ -1008,10 +1008,11 @@ COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE BlobInline::GetBreakConditions(
}
class ScreenLineLayout : public IScreenLineLayout {
- TextLayout textLayout;
std::string text;
std::wstring buffer;
std::vector<BlobInline> blobs;
+ // textLayout depends on blobs so must be declared after blobs so it is destroyed before blobs.
+ TextLayout textLayout;
static void FillTextLayoutFormats(const IScreenLine *screenLine, IDWriteTextLayout *textLayout, std::vector<BlobInline> &blobs);
static std::wstring ReplaceRepresentation(std::string_view text);
static size_t GetPositionInLayout(std::string_view text, size_t position);