[Libreoffice-commits] core.git: filter/source svx/source

Noel Grandin noel at peralex.com
Fri Jun 10 11:40:53 UTC 2016


 filter/source/msfilter/eschesdo.cxx |    6 ++++++
 svx/source/unodraw/unopage.cxx      |   20 ++++++++++----------
 2 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 7846169215aa5f7bfe78ce1050638d63cf6e412c
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jun 10 13:39:31 2016 +0200

    dispose of ImplEscherExSdr correctly
    
    to remove the warnings messages, and turn the warn into an assert to
    prevent it coming back
    
    Change-Id: Ie754ac07f8bb505439a1194f843d09c396353aa6

diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index b7312ee..4d2a309 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -860,6 +860,9 @@ ImplEscherExSdr::ImplEscherExSdr( EscherEx& rEx )
 ImplEscherExSdr::~ImplEscherExSdr()
 {
     DBG_ASSERT( !mpSolverContainer, "ImplEscherExSdr::~ImplEscherExSdr: unwritten SolverContainer" );
+    Reference<css::lang::XComponent> xComp(mXDrawPage, UNO_QUERY);
+    if (xComp.is())
+        xComp->dispose();
     delete mpSolverContainer;
 }
 
@@ -873,6 +876,9 @@ bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage )
         ImplFlushSolverContainer();
 
         mpSdrPage = nullptr;
+        Reference<css::lang::XComponent> xOldDrawPage(mXDrawPage, UNO_QUERY);
+        if (xOldDrawPage.is())
+            xOldDrawPage->dispose();
         mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( const_cast<SdrPage*>(&rPage) );
         mXShapes.set( mXDrawPage, UNO_QUERY );
         if ( !mXShapes.is() )
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index c7bbd96..e2afa10 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -80,7 +80,7 @@ SvxDrawPage::~SvxDrawPage() throw()
 {
     if( !mrBHelper.bDisposed )
     {
-        SAL_WARN("svx", "SvxDrawPage must be disposed!");
+        assert("SvxDrawPage must be disposed!");
         acquire();
         dispose();
     }
@@ -124,13 +124,13 @@ void SvxDrawPage::dispose()
     // Remark: It is an error to call dispose more than once
     bool bDoDispose = false;
     {
-    osl::MutexGuard aGuard( mrBHelper.rMutex );
-    if( !mrBHelper.bDisposed && !mrBHelper.bInDispose )
-    {
-        // only one call go into this section
-        mrBHelper.bInDispose = true;
-        bDoDispose = true;
-    }
+        osl::MutexGuard aGuard( mrBHelper.rMutex );
+        if( !mrBHelper.bDisposed && !mrBHelper.bInDispose )
+        {
+            // only one call go into this section
+            mrBHelper.bInDispose = true;
+            bDoDispose = true;
+        }
     }
 
     // Do not hold the mutex because we are broadcasting
@@ -153,13 +153,13 @@ void SvxDrawPage::dispose()
             // catch exception and throw again but signal that
             // the object was disposed. Dispose should be called
             // only once.
+            osl::MutexGuard aGuard( mrBHelper.rMutex );
             mrBHelper.bDisposed = true;
             mrBHelper.bInDispose = false;
             throw;
         }
 
-        // the values bDispose and bInDisposing must set in this order.
-        // No multithread call overcome the "!rBHelper.bDisposed && !rBHelper.bInDispose" guard.
+        osl::MutexGuard aGuard( mrBHelper.rMutex );
         mrBHelper.bDisposed = true;
         mrBHelper.bInDispose = false;
     }


More information about the Libreoffice-commits mailing list