[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sw/inc sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 15 22:38:03 UTC 2019
sw/inc/txtfld.hxx | 2 -
sw/source/core/doc/DocumentFieldsManager.cxx | 4 ++-
sw/source/core/fields/expfld.cxx | 32 ++++++++++++++++-----------
sw/source/core/txtnode/atrfld.cxx | 8 +++++-
4 files changed, 29 insertions(+), 17 deletions(-)
New commits:
commit 5ed6c4ade72fc13b475e795769a5049ea9765048
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Apr 15 15:03:14 2019 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Apr 16 00:37:31 2019 +0200
sw: fix recursive SwTextInputField::LockNotifyContentChange
(related: tdf#123968)
The assertion added in commit 742baabbe4d077e1ba913a7989300908f4637ac7
is triggered during ODF import of import fields associated with user
field types; there is a 3 level recursion of the SwUserFieldType for one
variable calling the SwInputFieldType calling SwUserFieldType of another
variable...
Change-Id: I54fc56733c7375cfdb6439b02cf21c4d852c2b4c
Reviewed-on: https://gerrit.libreoffice.org/70768
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
(cherry picked from commit 2eb92eaea9ad74b1488246af3c334c3829af36a1)
Reviewed-on: https://gerrit.libreoffice.org/70785
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
index 11c13edeedc9..38ca9caa6251 100644
--- a/sw/inc/txtfld.hxx
+++ b/sw/inc/txtfld.hxx
@@ -87,7 +87,7 @@ public:
virtual ~SwTextInputField() override;
- void LockNotifyContentChange();
+ bool LockNotifyContentChange();
void UnlockNotifyContentChange();
virtual void NotifyContentChange( SwFormatField& rFormatField ) override;
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 238e4ba71cf0..264ac6352f64 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1258,7 +1258,9 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
: dynamic_cast<SwTextInputField *>(pTextField));
if (pInputField)
{
- pInputField->LockNotifyContentChange();
+ bool const tmp = pInputField->LockNotifyContentChange();
+ (void) tmp;
+ assert(tmp && "should not be locked here?");
}
::comphelper::ScopeGuard g([pInputField]()
{
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 6a3bd6efb9e2..c9aceb9d9aaa 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -1263,23 +1263,29 @@ void SwInputField::applyFieldContent( const OUString& rNewFieldContent )
if( pUserTyp )
{
pUserTyp->SetContent( rNewFieldContent );
-
- // trigger update of the corresponding User Fields and other related Input Fields
- if ( GetFormatField() != nullptr )
+ if (!pUserTyp->IsModifyLocked())
{
- SwTextInputField* pTextInputField = dynamic_cast< SwTextInputField* >(GetFormatField()->GetTextField());
- if ( pTextInputField != nullptr )
+ // trigger update of the corresponding User Fields and other
+ // related Input Fields
+ bool bUnlock(false);
+ if (GetFormatField() != nullptr)
{
- pTextInputField->LockNotifyContentChange();
+ SwTextInputField *const pTextInputField =
+ dynamic_cast<SwTextInputField*>(GetFormatField()->GetTextField());
+ if (pTextInputField != nullptr)
+ {
+ bUnlock = pTextInputField->LockNotifyContentChange();
+ }
}
- }
- pUserTyp->UpdateFields();
- if ( GetFormatField() != nullptr )
- {
- SwTextInputField* pTextInputField = dynamic_cast< SwTextInputField* >(GetFormatField()->GetTextField());
- if ( pTextInputField != nullptr )
+ pUserTyp->UpdateFields();
+ if (bUnlock)
{
- pTextInputField->UnlockNotifyContentChange();
+ SwTextInputField *const pTextInputField =
+ dynamic_cast<SwTextInputField*>(GetFormatField()->GetTextField());
+ if (pTextInputField != nullptr)
+ {
+ pTextInputField->UnlockNotifyContentChange();
+ }
}
}
}
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index e32003ae1ba4..96f33d243eaa 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -564,10 +564,14 @@ SwTextInputField::~SwTextInputField()
{
}
-void SwTextInputField::LockNotifyContentChange()
+bool SwTextInputField::LockNotifyContentChange()
{
- assert(!m_bLockNotifyContentChange); // not nestable
+ if (m_bLockNotifyContentChange)
+ {
+ return false;
+ }
m_bLockNotifyContentChange = true;
+ return true;
}
void SwTextInputField::UnlockNotifyContentChange()
More information about the Libreoffice-commits
mailing list