[Libreoffice-commits] core.git: svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 27 21:22:37 UTC 2019
svx/source/unodraw/unoshtxt.cxx | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
New commits:
commit f331244337a9b2c70ac1bb52b0637c32956b7d91
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 27 17:21:22 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 27 22:22:08 2019 +0100
tdf#123470 textforwarder has stale view of SdrTextObj
When we save the document we get a SwXShape for the SdrObject and call
getShapeText on it, which creates a TextForwarder for it. The SwXShape
is temporary and is discarded afterwards. If we modify the text and
save again we get a new SwXShape and a new TextForwarder.
If a11y is active, then when the textbox is inserted a11y gets a SwXShape
for the object and the SwXShape stays alive while the a11y view of the
Sdrobject stays around.
The SdrObject will keep a weak ref to the current SwXShape for it, so
on save we get the already existing SwXShape instead of a new one. On the
first save this is ok, as the TextForwarder is created on demand.
On the second save, the problem is that the SvxTextEditSourceImpl of the
TextForwarded was initially created without a SdrView so its in sort of a
"snapshot" mode, so first time the text is queried, that sticks as the result.
So a cached text forwarder cannot be trusted when its for a SdrTextObj
that's being edited and HasView is false
Change-Id: Ib3d500752f1876086ef1996885a2b86b581f5bc4
Reviewed-on: https://gerrit.libreoffice.org/68457
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 2aadd092824b..bc8cb9f657e9 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -654,10 +654,26 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetTextForwarder()
return GetBackgroundTextForwarder();
}
else
+ {
+ // tdf#123470 if the text edit mode of the shape is active, then we
+ // cannot trust a previously cached TextForwarder state as the text may
+ // be out of date, so force a refetch in that case.
+ if (IsEditMode())
+ {
+ assert(!mbForwarderIsEditMode); // because without a view there is no other option except !mbForwarderIsEditMode
+ bool bTextEditActive = false;
+ SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(mpObject);
+ // similar to the GetBackgroundTextForwarder check, see if the text edit is active
+ if (pTextObj && pTextObj->getActiveText() == mpText && pTextObj->GetEditOutlinerParaObject())
+ bTextEditActive = true; // text edit active
+ if (bTextEditActive)
+ mbDataValid = false;
+ }
+
return GetBackgroundTextForwarder();
+ }
}
-
std::unique_ptr<SvxDrawOutlinerViewForwarder> SvxTextEditSourceImpl::CreateViewForwarder()
{
if( mpView->GetTextEditOutlinerView() && mpObject )
More information about the Libreoffice-commits
mailing list