From 929ed4c7742e5b18e1b571799fc276b57c3825ea Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Fri, 26 Jul 2024 13:01:00 +0900 Subject: [PATCH] Fix text visual discard issue The text visual will be destroyed at next idle time. Set AsyncTextInterface to nullptr immediately.. This prevents access to the async text interface until the visual is actually destroyed. Change-Id: Idc1671b2a2f6a3f322fd58cfb1b09489486e5b4c Signed-off-by: Bowon Ryu --- .../internal/controls/text-controls/text-label-impl.cpp | 2 ++ dali-toolkit/internal/visuals/text/text-visual.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 2d25b26..d5af313 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -247,6 +247,8 @@ void DiscardTextLabelVisual(Dali::Toolkit::Visual::Base& visual) { if(DALI_LIKELY(Dali::Stage::IsInstalled() && visual)) { + // This prevents access to the async text interface until the visual is actually destroyed. + TextVisual::SetAsyncTextInterface(visual, nullptr); Dali::Toolkit::VisualFactory::Get().DiscardVisual(visual); } visual.Reset(); diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index b9c166e..8ca9e54 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -757,14 +757,6 @@ void TextVisual::LoadComplete(bool loadingSuccess, TextInformation textInformati { resourceStatus = Toolkit::Visual::ResourceStatus::READY; - Actor control = mControl.GetHandle(); - if(!control) - { - // Nothing to do. - ResourceReady(Toolkit::Visual::ResourceStatus::READY); - return; - } - Text::AsyncTextRenderInfo renderInfo = textInformation.renderInfo; if(parameters.requestType == Text::Async::COMPUTE_NATURAL_SIZE || parameters.requestType == Text::Async::COMPUTE_HEIGHT_FOR_WIDTH) @@ -776,6 +768,14 @@ void TextVisual::LoadComplete(bool loadingSuccess, TextInformation textInformati } } + Actor control = mControl.GetHandle(); + if(!control) + { + // Nothing to do. + ResourceReady(Toolkit::Visual::ResourceStatus::READY); + return; + } + // Calculate the size of the visual that can fit the text. // The size of the text after it has been laid-out, size of pixel data buffer. Size layoutSize(static_cast(renderInfo.width), static_cast(renderInfo.height)); -- 2.7.4