You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/02/24 21:25:27 UTC

svn commit: r1571426 - /openoffice/trunk/main/oox/source/core/xmlfilterbase.cxx

Author: alg
Date: Mon Feb 24 20:25:26 2014
New Revision: 1571426

URL: http://svn.apache.org/r1571426
Log:
i118640 force early destruction of last FragmentHandler to not let it use an already destroyed RelationsMap instance

Modified:
    openoffice/trunk/main/oox/source/core/xmlfilterbase.cxx

Modified: openoffice/trunk/main/oox/source/core/xmlfilterbase.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/oox/source/core/xmlfilterbase.cxx?rev=1571426&r1=1571425&r2=1571426&view=diff
==============================================================================
--- openoffice/trunk/main/oox/source/core/xmlfilterbase.cxx (original)
+++ openoffice/trunk/main/oox/source/core/xmlfilterbase.cxx Mon Feb 24 20:25:26 2014
@@ -87,6 +87,7 @@ struct XmlFilterBaseImpl
     TextFieldStack      maTextFieldStack;
 
     explicit            XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException );
+    ~XmlFilterBaseImpl();
 };
 
 // ----------------------------------------------------------------------------
@@ -121,6 +122,10 @@ XmlFilterBaseImpl::XmlFilterBaseImpl( co
     maFastParser.registerNamespace( NMSP_markupCompat );    // i123528
 }
 
+XmlFilterBaseImpl::~XmlFilterBaseImpl()
+{
+}
+
 // ============================================================================
 
 XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
@@ -133,6 +138,14 @@ XmlFilterBase::XmlFilterBase( const Refe
 
 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 );
 }
 
 // ----------------------------------------------------------------------------