embeddedobj/qa/cppunit/msole.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 7ad22252171f1e8c0ad65f0b9f8e38024f1e1bde
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Oct 11 20:57:35 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Oct 12 10:29:17 2022 +0200

    try to make CppunitTest_embeddedobj_msole more reliable
    
    It sometimes crashes on windows. Switch to using the same
    tearDown() logic as UnoApiTest::closeDocument, which
    seems to be the most reliable variant of this kind of code.
    
    Change-Id: I1493d6d265763b2aec4ee94f4ee66378dbe280b6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141238
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/embeddedobj/qa/cppunit/msole.cxx b/embeddedobj/qa/cppunit/msole.cxx
index c7ec2476f8a1..778186f01b55 100644
--- a/embeddedobj/qa/cppunit/msole.cxx
+++ b/embeddedobj/qa/cppunit/msole.cxx
@@ -15,6 +15,7 @@
 #include <com/sun/star/embed/XStorage.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/packages/zip/ZipFileAccess.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
 
 #include <comphelper/embeddedobjectcontainer.hxx>
 #include <comphelper/propertyvalue.hxx>
@@ -55,8 +56,12 @@ void Test::setUp()
 
 void Test::tearDown()
 {
-    if (mxComponent.is())
-        mxComponent->dispose();
+    if (mxComponent)
+    {
+        uno::Reference<util::XCloseable> xCloseable(mxComponent, 
css::uno::UNO_QUERY_THROW);
+        xCloseable->close(false);
+        mxComponent.clear();
+    }
 
     test::BootstrapFixture::tearDown();
 }

Reply via email to