From 581870605c7079dac66f847135704c0b44b32c63 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 29 Mar 2025 18:03:57 +1100 Subject: Reorder fields to ensure textLayout destroyed before blobs which it depends on. Otherwise there may be a crash inside DirectWrite. --- win32/SurfaceD2D.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 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 &blobs); static std::wstring ReplaceRepresentation(std::string_view text); static size_t GetPositionInLayout(std::string_view text, size_t position); -- cgit v1.2.3