[Libreoffice-commits] core.git: Branch 'aoo/trunk' - oox/source

Armin Le Grand alg at apache.org
Mon Feb 24 14:07:58 PST 2014


 oox/source/core/xmlfilterbase.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 190444f7fd3fa9cfcd1955b3f5dcd916184d02f4
Author: Armin Le Grand <alg at apache.org>
Date:   Mon Feb 24 20:25:26 2014 +0000

    i118640 force early destruction of last FragmentHandler to not let it use an already destroyed RelationsMap instance

diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 8f7408c..6c11667 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -87,6 +87,7 @@ struct XmlFilterBaseImpl
     TextFieldStack      maTextFieldStack;
 
     explicit            XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException );
+    ~XmlFilterBaseImpl();
 };
 
 // ----------------------------------------------------------------------------
@@ -121,6 +122,10 @@ XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxCo
     maFastParser.registerNamespace( NMSP_markupCompat );    // i123528
 }
 
+XmlFilterBaseImpl::~XmlFilterBaseImpl()
+{
+}
+
 // ============================================================================
 
 XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
@@ -133,6 +138,14 @@ XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext )
 
 XmlFilterBase::~XmlFilterBase()
 {
+    // #118640# Reset the DocumentHandler at the FastSaxParser manually; this is
+    // needed since the mechanism is that instances of FragmentHandler execute
+    // their stuff (creating objects, setting attributes, ...) on being destroyed.
+    // They get destroyed by setting a new DocumentHandler. This also happens in
+    // the following implicit destruction chain of ~XmlFilterBaseImpl, but in that
+    // case it's member RelationsMap maRelationsMap will be destroyed, but maybe
+    // still be used by ~FragmentHandler -> crash.
+    mxImpl->maFastParser.setDocumentHandler( 0 );
 }
 
 // ----------------------------------------------------------------------------


More information about the Libreoffice-commits mailing list