[Libreoffice-commits] core.git: 4 commits - include/editeng include/xmloff sw/source xmloff/source
Michael Stahl
mstahl at redhat.com
Wed Jul 5 09:37:39 UTC 2017
include/editeng/editdata.hxx | 15 +++++++++++++++
include/xmloff/txtstyli.hxx | 9 ---------
sw/source/core/access/accmap.cxx | 5 +++++
sw/source/core/undo/undel.cxx | 15 +++++++++++++++
xmloff/source/text/txtimp.cxx | 4 ++--
xmloff/source/text/txtstyli.cxx | 20 ++++++++++----------
6 files changed, 47 insertions(+), 21 deletions(-)
New commits:
commit ddf8d9a150e3e1725de65577c48d47918b4b11a8
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jul 4 22:46:15 2017 +0200
sw: fix use-after-free in SwAccessibleMap::FireEvents()
As seen when running JunitTest_sw_unoapi_3 against "make debugrun",
the damn thing can call itself recursively via an odd corner case in
GetContext():
0 in SwAccessibleEventList_Impl::~SwAccessibleEventList_Impl() (this=0x9a6a170, __in_chrg=<optimized out>) at sw/source/core/access/accmap.cxx:498
1 in SwAccessibleMap::FireEvents() (this=0x8198bb0) at sw/source/core/access/accmap.cxx:3023
2 in SwAccessibleMap::InvalidateCursorPosition(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> const&) (this=0x8198bb0, rAcc=uno::Reference to (SwAccessibleParagraph *) 0x9a439d8) at sw/source/core/access/accmap.cxx:1069
3 in SwAccessibleMap::GetContext(SwFrame const*, bool) (this=0x8198bb0, pFrame=0x825ca10, bCreate=true) at sw/source/core/access/accmap.cxx:1925
4 in SwAccessibleMap::GetContextImpl(SwFrame const*, bool) (this=0x8198bb0, pFrame=0x825ca10, bCreate=true) at sw/source/core/access/accmap.cxx:1936
5 in SwAccessibleContext::InvalidateChildPosOrSize(sw::access::SwAccessibleChild const&, SwRect const&) (this=0x405a350, rChildFrameOrObj=..., rOldFrame=SwRect = {...}) at sw/source/core/access/acccontext.cxx:1196
6 in SwAccessibleMap::FireEvent(SwAccessibleEvent_Impl const&) (this=0x8198bb0, rEvent=...) at sw/source/core/access/accmap.cxx:898
7 in SwAccessibleMap::FireEvents() (this=0x8198bb0) at sw/source/core/access/accmap.cxx:3018
8 in SwViewShellImp::FireAccessibleEvents() (this=0x7744dc0) at sw/source/core/view/viewimp.cxx:460
9 in SwLayIdle::SwLayIdle(SwRootFrame*, SwViewShellImp*) (this=0x7ffc63395e30, pRt=0x7745120, pI=0x7744dc0) at sw/source/core/layout/layact.cxx:2267
Presumably all of mpEvents, mpEventMap and mpShapes must live until
the outermost FireEvents() completes.
Change-Id: I4e5a053035bf7fc12d9407913437d721889950ae
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 3c328fda911a..0a0337929ab4 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -3010,6 +3010,11 @@ void SwAccessibleMap::FireEvents()
osl::MutexGuard aGuard( maEventMutex );
if( mpEvents )
{
+ if (mpEvents->IsFiring())
+ {
+ return; // prevent recursive FireEvents()
+ }
+
mpEvents->SetFiring();
mpEvents->MoveMissingXAccToEnd();
for( auto const& aEvent : *mpEvents )
commit 789433da173ddf528e31a93d15ab5adfe722d183
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jul 4 17:36:05 2017 +0200
xmloff: XMLTextStyleContext: remove property name constant members
Change-Id: Ica367371f1f7fb6e7858c8e35ec4c8de994e357d
diff --git a/include/xmloff/txtstyli.hxx b/include/xmloff/txtstyli.hxx
index 0588e52aa004..0c7e5891ae57 100644
--- a/include/xmloff/txtstyli.hxx
+++ b/include/xmloff/txtstyli.hxx
@@ -33,15 +33,6 @@ class XMLOFF_DLLPUBLIC XMLTextStyleContext : public XMLPropStyleContext
OUString m_sDropCapTextStyleName;
OUString m_sMasterPageName;
OUString m_sDataStyleName; // for grid columns only
- const OUString sIsAutoUpdate;
- const OUString sCategory;
- const OUString sNumberingStyleName;
- const OUString sOutlineLevel;
-
-public:
- const OUString sDropCapCharStyleName;
-private:
- const OUString sPageDescName;
sal_Int8 m_nOutlineLevel;
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index dc6b16147c19..b2653f152871 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1752,9 +1752,9 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
XML_STYLE_FAMILY_TEXT_TEXT,
pStyle->GetDropCapStyleName()) );
if (m_xImpl->m_xTextStyles->hasByName(sDisplayName) &&
- xPropSetInfo->hasPropertyByName( pStyle->sDropCapCharStyleName ) )
+ xPropSetInfo->hasPropertyByName("DropCapCharStyleName"))
{
- xPropSet->setPropertyValue( pStyle->sDropCapCharStyleName, makeAny(sDisplayName) );
+ xPropSet->setPropertyValue("DropCapCharStyleName", makeAny(sDisplayName));
}
}
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index 345bd60c0889..b03e0382c73f 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -133,12 +133,6 @@ XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport,
SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
bool bDefaultStyle )
: XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle )
-, sIsAutoUpdate( "IsAutoUpdate" )
-, sCategory( "Category" )
-, sNumberingStyleName( "NumberingStyleName" )
-, sOutlineLevel("OutlineLevel" )
-, sDropCapCharStyleName( "DropCapCharStyleName" )
-, sPageDescName( "PageDescName" )
, m_nOutlineLevel( -1 )
, m_isAutoUpdate( false )
, m_bHasMasterPageName( false )
@@ -211,6 +205,8 @@ void XMLTextStyleContext::CreateAndInsert( bool bOverwrite )
Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
Reference< XPropertySetInfo > xPropSetInfo =
xPropSet->getPropertySetInfo();
+
+ OUString const sIsAutoUpdate("IsAutoUpdate");
if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
{
xPropSet->setPropertyValue( sIsAutoUpdate, Any(m_isAutoUpdate) );
@@ -219,10 +215,10 @@ void XMLTextStyleContext::CreateAndInsert( bool bOverwrite )
sal_uInt16 nCategory = ParagraphStyleCategory::TEXT;
if( XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() &&
!m_sCategoryVal.isEmpty() && xStyle->isUserDefined() &&
- xPropSetInfo->hasPropertyByName( sCategory ) &&
+ xPropSetInfo->hasPropertyByName("Category") &&
SvXMLUnitConverter::convertEnum( nCategory, m_sCategoryVal, aCategoryMap))
{
- xPropSet->setPropertyValue( sCategory, Any((sal_Int16)nCategory) );
+ xPropSet->setPropertyValue("Category", Any(static_cast<sal_Int16>(nCategory)));
}
// tell the style about it's events (if applicable)
@@ -277,6 +273,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite )
Reference< XPropertySetInfo > xPropSetInfo =
xPropSet->getPropertySetInfo();
+ OUString const sOutlineLevel("OutlineLevel");
if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
{
if (m_nOutlineLevel >= 0)
@@ -286,6 +283,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite )
}
// Consider set empty list style (#i69523#)
+ OUString const sNumberingStyleName("NumberingStyleName");
if (m_bListStyleSet &&
xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
{
@@ -352,9 +350,9 @@ void XMLTextStyleContext::Finish( bool bOverwrite )
GetImport().GetTextImport()->GetTextStyles();
if( rTextStyles.is() &&
rTextStyles->hasByName( sDisplayDropCapTextStyleName ) &&
- xPropSetInfo->hasPropertyByName( sDropCapCharStyleName ) )
+ xPropSetInfo->hasPropertyByName("DropCapCharStyleName"))
{
- xPropSet->setPropertyValue( sDropCapCharStyleName, Any(sDisplayDropCapTextStyleName) );
+ xPropSet->setPropertyValue("DropCapCharStyleName", Any(sDisplayDropCapTextStyleName));
}
}
@@ -366,6 +364,8 @@ void XMLTextStyleContext::Finish( bool bOverwrite )
// The families container must exist
const Reference < XNameContainer >& rPageStyles =
GetImport().GetTextImport()->GetPageStyles();
+
+ OUString const sPageDescName("PageDescName");
if( ( sDisplayName.isEmpty() ||
(rPageStyles.is() &&
rPageStyles->hasByName( sDisplayName )) ) &&
commit c9c1135de2be25c8630c1197df80e5ceb4f9907a
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jul 4 17:20:56 2017 +0200
editeng: add some operator<< for ESelection, EPosition
Change-Id: I4c3ff2101e7e80c0738401753333bc8c088987f3
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
index 12b6bff6474d..cf19fbde88d4 100644
--- a/include/editeng/editdata.hxx
+++ b/include/editeng/editdata.hxx
@@ -24,6 +24,7 @@
#include <rtl/ustring.hxx>
#include <editeng/editengdllapi.h>
#include <memory>
+#include <ostream>
class SfxItemSet;
class SfxPoolItem;
@@ -106,6 +107,13 @@ struct EPosition
{ }
};
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, EPosition const& pos)
+{
+ return stream << "EPosition(" << pos.nPara << ',' << pos.nIndex << ")";
+}
+
struct ESelection
{
sal_Int32 nStartPara;
@@ -138,6 +146,13 @@ struct ESelection
bool HasRange() const;
};
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, ESelection const& sel)
+{
+ return stream << "ESelection(" << sel.nStartPara << ',' << sel.nStartPos << "," << sel.nEndPara << "," << sel.nEndPos << ")";
+}
+
inline bool ESelection::HasRange() const
{
return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos );
commit b4c4187bcc6ab03be1b9c1c05cf992677c546c08
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jul 4 15:49:52 2017 +0200
sw: fix Undo strings when deleting input fields and fieldmarks
Filter our current collection of magic dummy chars in
DenoteSpecialCharacters() so that no weird U+000004 code points are
displayed in tooltips of the Undo button.
Change-Id: I7c7fe9b79b452624bb2569ffa18939e3e5ab1a53
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index dfae9e8e779a..94a86342db6d 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -564,6 +564,11 @@ static bool lcl_IsSpecialCharacter(sal_Unicode nChar)
case CH_TXTATR_INWORD:
case CH_TXTATR_TAB:
case CH_TXTATR_NEWLINE:
+ case CH_TXT_ATR_INPUTFIELDSTART:
+ case CH_TXT_ATR_INPUTFIELDEND:
+ case CH_TXT_ATR_FORMELEMENT:
+ case CH_TXT_ATR_FIELDSTART:
+ case CH_TXT_ATR_FIELDEND:
return true;
default:
@@ -598,6 +603,16 @@ static OUString lcl_DenotedPortion(const OUString& rStr, sal_Int32 nStart, sal_I
aResult = SwRewriter::GetPlaceHolder(UndoArg2);
break;
+ case CH_TXT_ATR_INPUTFIELDSTART:
+ case CH_TXT_ATR_INPUTFIELDEND:
+ case CH_TXT_ATR_FORMELEMENT:
+ case CH_TXT_ATR_FIELDSTART:
+ case CH_TXT_ATR_FIELDEND:
+ break; // nothing?
+
+ default:
+ assert(!"unexpected special character");
+ break;
}
SwRewriter aRewriter;
aRewriter.AddRule(UndoArg1,
More information about the Libreoffice-commits
mailing list