[Libreoffice-commits] core.git: 2 commits - filter/source sw/qa unotest/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 29 08:05:36 UTC 2020


 filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx |   38 ++++++++++++++------
 sw/qa/python/xcontrolshape.py                       |    3 +
 unotest/source/python/org/libreoffice/unotest.py    |   11 +++--
 3 files changed, 35 insertions(+), 17 deletions(-)

New commits:
commit f2aca4e038888b32650027b5c7d67eda69a8fd48
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Wed Oct 28 13:09:52 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 29 09:05:10 2020 +0100

    python test shutdown robustness
    
    so when a test fails, we don't get spurious additional stacktraces
    
    Change-Id: Id2885be9ca628fc25a55f90f6c5c1b50f887a37a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104928
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/qa/python/xcontrolshape.py b/sw/qa/python/xcontrolshape.py
index cfbcedba73c9..336a6d3449c0 100644
--- a/sw/qa/python/xcontrolshape.py
+++ b/sw/qa/python/xcontrolshape.py
@@ -23,7 +23,8 @@ class TestXControlShape(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
-        cls._uno.tearDown()
+        if cls._uno:
+            cls._uno.tearDown()
 
     def test_getAndSetControlShape(self):
         xDoc = self.__class__._uno.openDocFromTDOC("xcontrolshape.odt")
diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py
index 8b421e167c0c..e27f9e145de4 100644
--- a/unotest/source/python/org/libreoffice/unotest.py
+++ b/unotest/source/python/org/libreoffice/unotest.py
@@ -243,11 +243,12 @@ class UnoInProcess:
         assert(self.xContext)
     def tearDown(self):
         if hasattr(self, 'xDoc'):
-            self.xDoc.close(True)
-            # HACK in case self.xDoc holds a UNO proxy to an SwXTextDocument (whose dtor calls
-            # Application::GetSolarMutex via sw::UnoImplPtrDeleter), which would potentially only be
-            # garbage-collected after VCL has already been deinitialized:
-            self.xDoc = None
+            if self.xDoc:
+                self.xDoc.close(True)
+                # HACK in case self.xDoc holds a UNO proxy to an SwXTextDocument (whose dtor calls
+                # Application::GetSolarMutex via sw::UnoImplPtrDeleter), which would potentially only be
+                # garbage-collected after VCL has already been deinitialized:
+                self.xDoc = None
 
 def simpleInvoke(connection, test):
     try:
commit 4229467fa8528531dc27784f07bc54488c0d2fa9
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Oct 28 21:44:13 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 29 09:04:55 2020 +0100

    crashtesting rhbz909647-2
    
    as a consequence of
        commit 2b946d245eaf4bd40a0091aa5508315fc37c81a0
        Date:   Mon Oct 19 09:36:04 2020 +0200
        XmlFilterAdaptor: use the fastparser API when possible
    re-introduce slowparser support here
    
    Change-Id: I95470e51508f8e250f27c5af7ffdc1b737c16ab9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104975
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index dfebcced36db..44839ceb3f2d 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -110,11 +110,10 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
 
 
     // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
+    // ...except when it's one of the XMLTransformer subclasses
     Reference < XInterface > xFilter = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( sXMLImportService, aAnys, mxContext );
     assert(xFilter);
-    Reference < XFastDocumentHandler > xHandler( xFilter, UNO_QUERY );
-    assert(xHandler);
-    Reference < XImporter > xImporter( xHandler, UNO_QUERY );
+    Reference < XImporter > xImporter( xFilter, UNO_QUERY );
     assert(xImporter);
     xImporter->setTargetDocument ( mxDoc );
 
@@ -166,8 +165,6 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
         }
     }
 
-//    sal_Bool xconv_ret = sal_True;
-
     if (xStatusIndicator.is()){
         xStatusIndicator->setValue(nSteps++);
     }
@@ -175,25 +172,44 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
     // Calling Filtering Component
 
     try {
-        auto pImport = dynamic_cast<SvXMLImport*>(xHandler.get());
-        assert(pImport);
-        if (xConverter2)
+        Reference < XFastParser > xFastParser( xFilter, UNO_QUERY ); // SvXMLImport subclasses
+        Reference < XDocumentHandler > xDocHandler( xFilter, UNO_QUERY ); // XMLTransformer subclasses
+        assert(xFastParser || xDocHandler);
+        if (xConverter2 && xFastParser)
         {
-            if (!xConverter2->importer(aDescriptor,pImport,msUserData)) {
+            if (!xConverter2->importer(aDescriptor,xFastParser,msUserData)) {
                 if (xStatusIndicator.is())
                     xStatusIndicator->end();
                 return false;
             }
         }
-        else
+        else if (xConverter1 && xDocHandler)
         {
-            Reference<XDocumentHandler> xDocHandler = new SvXMLLegacyToFastDocHandler(pImport);
             if (!xConverter1->importer(aDescriptor,xDocHandler,msUserData)) {
                 if (xStatusIndicator.is())
                     xStatusIndicator->end();
                 return false;
             }
         }
+        else if (xConverter1 && xFastParser)
+        {
+            auto pImport = dynamic_cast<SvXMLImport*>(xFastParser.get());
+            assert(pImport);
+            Reference<XDocumentHandler> xLegacyDocHandler = new SvXMLLegacyToFastDocHandler(pImport);
+            if (!xConverter1->importer(aDescriptor,xLegacyDocHandler,msUserData)) {
+                if (xStatusIndicator.is())
+                    xStatusIndicator->end();
+                return false;
+            }
+        }        
+        else
+        {
+            SAL_WARN("filter.xmlfa", "no working combination found");
+            assert(false);
+            if (xStatusIndicator.is())
+                xStatusIndicator->end();
+            return false;
+        }
     }
     catch( const Exception& )
     {


More information about the Libreoffice-commits mailing list