[Libreoffice-commits] .: 2 commits - sfx2/qa svl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 13:04:32 PDT 2012


 sfx2/qa/complex/sfx2/DocumentInfo.java |   31 ++++++++-----------------------
 svl/source/items/style.cxx             |    5 ++++-
 2 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit 96d5134d4ddf66c517c6a024c2624ee0a8cc9ac4
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 14 21:53:00 2012 +0200

    SfxStyleSheetBasePool::Remove: fix valgrind warning:
    
    aStyles contains rtl::References, so the erase() call may cause "p" to
    be deleted, while "p" is then used as a parameter to Broadcast;
    avoid this by retaining the rtl::Reference on the stack a bit longer.
    Valgrind warning observed in sc_unoapi sc.ScStyleFamilyObj on
    libreoffice-3-6 branch, called by ScStyleFamilyObj::removeByName.
    
    Change-Id: I96d6de85b1b182b5ae3f74e92987a7f137537ffb

diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 3f6b768..2a434b8 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -740,7 +740,10 @@ void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
 {
     if( p )
     {
-        SfxStyles::iterator aIter( std::find( aStyles.begin(), aStyles.end(), rtl::Reference< SfxStyleSheetBase >( p ) ) );
+        // Reference to keep p alive until after Broadcast call!
+        rtl::Reference<SfxStyleSheetBase> xP(p);
+        SfxStyles::iterator const aIter(
+                std::find(aStyles.begin(), aStyles.end(), xP));
         if( aIter != aStyles.end() )
         {
             // Alle Styles umsetzen, deren Parent dieser hier ist
commit c3da81104bf6b82a3688c82ed341666c8f5eeec0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 14 19:10:10 2012 +0200

    sfx2: DocumentInfo test should use a private temp dir
    
    At least it failed on me once trying to store to its temp file, maybe
    the predictable file name was the problem...
    
    Change-Id: I78918ada1615c8337e4c8692d34aa285010bc820

diff --git a/sfx2/qa/complex/sfx2/DocumentInfo.java b/sfx2/qa/complex/sfx2/DocumentInfo.java
index 4822153..1532a3c 100644
--- a/sfx2/qa/complex/sfx2/DocumentInfo.java
+++ b/sfx2/qa/complex/sfx2/DocumentInfo.java
@@ -51,7 +51,7 @@ public class DocumentInfo
     XTextDocument xTextDoc = null;
     XTextDocument xTextDocSecond = null;
 
-    @Test public void checkDocInfo()
+    @Test public void checkDocInfo() throws Exception
     {
         m_xMSF = getMSF();
 
@@ -59,8 +59,7 @@ public class DocumentInfo
 
         assertNotNull("## Couldn't get MultiServiceFactory make sure your Office is started", m_xMSF);
 
-        // TODO: need other temp directory!
-        String tempdir = System.getProperty("java.io.tmpdir");
+        String tempdir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
         String fs = System.getProperty("file.separator");
 
         if (!tempdir.endsWith(fs))
@@ -127,16 +126,9 @@ public class DocumentInfo
 
 
             System.out.println("Storing the document");
-            try
-            {
-                XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc);
-                store.storeToURL(sTempDocument, new PropertyValue[] {});
-                DesktopTools.closeDoc(xTextDoc);
-            }
-            catch (Exception e)
-            {
-                fail("Couldn't store document");
-            }
+            XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc);
+            store.storeToURL(sTempDocument, new PropertyValue[] {});
+            DesktopTools.closeDoc(xTextDoc);
 
             System.out.println("...done");
         }
@@ -146,16 +138,9 @@ public class DocumentInfo
         {
             System.out.println("loading the document");
 
-            try
-            {
-                XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, m_xMSF.createInstance("com.sun.star.frame.Desktop"));
-                XComponent xComp = xCL.loadComponentFromURL(sTempDocument, "_blank", 0, new PropertyValue[] {});
-                xTextDocSecond = UnoRuntime.queryInterface(XTextDocument.class, xComp);
-            }
-            catch (Exception e)
-            {
-                fail("Couldn't load document");
-            }
+            XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, m_xMSF.createInstance("com.sun.star.frame.Desktop"));
+            XComponent xComp = xCL.loadComponentFromURL(sTempDocument, "_blank", 0, new PropertyValue[] {});
+            xTextDocSecond = UnoRuntime.queryInterface(XTextDocument.class, xComp);
 
             System.out.println("...done");
 


More information about the Libreoffice-commits mailing list