[Libreoffice-commits] core.git: 8 commits - sw/source

Michael Stahl mstahl at redhat.com
Fri Mar 24 17:06:06 UTC 2017


 sw/source/core/access/acccell.cxx         |    1 
 sw/source/core/access/acccontext.cxx      |   46 ++++++++++--------------------
 sw/source/core/access/acccontext.hxx      |   29 +++---------------
 sw/source/core/access/accdoc.cxx          |   35 +++++++++++++++-------
 sw/source/core/access/accfootnote.cxx     |    2 -
 sw/source/core/access/accframebase.cxx    |    2 -
 sw/source/core/access/accheaderfooter.cxx |    4 --
 sw/source/core/access/accmap.cxx          |   14 +++++----
 sw/source/core/access/accpage.cxx         |    8 +----
 sw/source/core/access/accpara.cxx         |   24 +++++++++++----
 sw/source/core/access/acctable.cxx        |    4 +-
 11 files changed, 75 insertions(+), 94 deletions(-)

New commits:
commit 125ca372c1d0821139b4c682a02494294b322473
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 17:49:07 2017 +0100

    sw: just remove SwAccesibleContext must-override methods
    
    What's the point?
    
    Change-Id: Ifdff4aae85282d213f82bd2d69f61f96f8b5e40c

diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 9263e150a681..bedbb8c7a813 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -678,12 +678,6 @@ sal_Int16 SAL_CALL SwAccessibleContext::getAccessibleRole()
     return m_nRole;
 }
 
-OUString SAL_CALL SwAccessibleContext::getAccessibleDescription()
-{
-    assert(!"description needs to be overridden");
-    throw uno::RuntimeException("description needs to be overridden");
-}
-
 OUString SAL_CALL SwAccessibleContext::getAccessibleName()
 {
     return m_sName;
@@ -975,23 +969,11 @@ sal_Int32 SAL_CALL SwAccessibleContext::getBackground()
     return COL_WHITE;
 }
 
-OUString SAL_CALL SwAccessibleContext::getImplementationName()
-{
-    assert(!"implementation name needs to be overridden");
-    throw uno::RuntimeException("implementation name needs to be overridden");
-}
-
 sal_Bool SAL_CALL SwAccessibleContext::supportsService (const OUString& ServiceName)
 {
     return cppu::supportsService(this, ServiceName);
 }
 
-uno::Sequence< OUString > SAL_CALL SwAccessibleContext::getSupportedServiceNames()
-{
-    assert(!"supported services names needs to be overridden");
-    throw uno::RuntimeException("supported services names needs to be overridden");
-}
-
 void SwAccessibleContext::DisposeShape( const SdrObject *pObj,
                                 ::accessibility::AccessibleShape *pAccImpl )
 {
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index 4c006266c475..1dc8b1972168 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -230,9 +230,7 @@ public:
     virtual sal_Int16 SAL_CALL
         getAccessibleRole() override;
 
-    // Return this object's description.
-    virtual OUString SAL_CALL
-        getAccessibleDescription() override;
+    // getAccessibleDescription() is abstract
 
     // Return the object's current name.
     virtual OUString SAL_CALL
@@ -282,19 +280,12 @@ public:
 
     // XServiceInfo
 
-    /** Returns an identifier for the implementation of this object. */
-    virtual OUString SAL_CALL
-        getImplementationName() override;
+    // getImplementationName() and getSupportedServiceNames are abstract
 
     /** Return whether the specified service is supported by this class. */
     virtual sal_Bool SAL_CALL
         supportsService (const OUString& sServiceName) override;
 
-    /** Returns a list of all supported services.  In this case that is just
-        the AccessibleContext service. */
-    virtual css::uno::Sequence< OUString> SAL_CALL
-        getSupportedServiceNames() override;
-
     // thread safe C++ interface
 
     // The object is not visible an longer and should be destroyed
commit d9c2ba239d0b3d71aa64fc9319b7b1025517170f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 17:42:39 2017 +0100

    sw: remove THROW_RUNTIME_EXCEPTION macro
    
    Change-Id: I74d4b31ea619c94245759b7a061c40095a0879ad

diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index f93cc5d2c1e0..9263e150a681 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -680,8 +680,8 @@ sal_Int16 SAL_CALL SwAccessibleContext::getAccessibleRole()
 
 OUString SAL_CALL SwAccessibleContext::getAccessibleDescription()
 {
-    OSL_ENSURE(false, "description needs to be overridden");
-    THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (method must be overridden)" );
+    assert(!"description needs to be overridden");
+    throw uno::RuntimeException("description needs to be overridden");
 }
 
 OUString SAL_CALL SwAccessibleContext::getAccessibleName()
@@ -977,9 +977,8 @@ sal_Int32 SAL_CALL SwAccessibleContext::getBackground()
 
 OUString SAL_CALL SwAccessibleContext::getImplementationName()
 {
-    OSL_ENSURE( false, "implementation name needs to be overridden" );
-
-    THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "implementation name needs to be overridden" )
+    assert(!"implementation name needs to be overridden");
+    throw uno::RuntimeException("implementation name needs to be overridden");
 }
 
 sal_Bool SAL_CALL SwAccessibleContext::supportsService (const OUString& ServiceName)
@@ -989,8 +988,8 @@ sal_Bool SAL_CALL SwAccessibleContext::supportsService (const OUString& ServiceN
 
 uno::Sequence< OUString > SAL_CALL SwAccessibleContext::getSupportedServiceNames()
 {
-    OSL_ENSURE( false, "supported services names needs to be overridden" );
-    THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "supported services needs to be overridden" )
+    assert(!"supported services names needs to be overridden");
+    throw uno::RuntimeException("supported services names needs to be overridden");
 }
 
 void SwAccessibleContext::DisposeShape( const SdrObject *pObj,
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index a9aeffec8550..4c006266c475 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -360,13 +360,6 @@ public:
                                         const OUString *pArg2 = nullptr );
 };
 
-// some heavily used exception support
-#define THROW_RUNTIME_EXCEPTION( ifc, msg )         \
-    css::uno::Reference < ifc > xThis( this );      \
-    css::uno::RuntimeException aExcept(             \
-        msg, xThis );       \
-    throw aExcept;
-
 #define CHECK_FOR_DEFUNC_THIS( ifc, ths )                \
     if( !(GetFrame() && GetMap()) )                        \
     {                                                    \
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 358472664edf..449e9a910b78 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -938,7 +938,7 @@ lang::Locale SAL_CALL SwAccessibleParagraph::getLocale()
     const SwTextFrame *pTextFrame = dynamic_cast<const SwTextFrame*>( GetFrame()  );
     if( !pTextFrame )
     {
-        THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (no text frame)" );
+        throw uno::RuntimeException("no SwTextFrame", static_cast<cppu::OWeakObject*>(this));
     }
 
     const SwTextNode *pTextNd = pTextFrame->GetTextNode();
commit c1f5339c169c893e63c0de25d0cad3029b475d1b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 17:34:47 2017 +0100

    sw: remove CHECK_FOR_WINDOW macro
    
    Change-Id: Ie375b199e055a01b0888a6efe56ef3a2801412b2

diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index c125729c0bec..f93cc5d2c1e0 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -787,7 +787,10 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint
     uno::Reference< XAccessible > xAcc;
 
     vcl::Window *pWin = GetWindow();
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
     if( !GetFrame()->IsRootFrame() )
@@ -843,7 +846,14 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(bool bRelative)
     OSL_ENSURE( pParent, "no Parent found" );
     vcl::Window *pWin = GetWindow();
 
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin && pParent )
+    if (!pParent)
+    {
+        throw uno::RuntimeException("no Parent", static_cast<cppu::OWeakObject*>(this));
+    }
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root
     Rectangle aPixBounds( 0, 0, 0, 0 );
@@ -896,7 +906,10 @@ awt::Point SAL_CALL SwAccessibleContext::getLocationOnScreen()
     Point aPixPos(aRect.X, aRect.Y);
 
     vcl::Window *pWin = GetWindow();
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     aPixPos = pWin->OutputToAbsoluteScreenPixel(aPixPos);
     awt::Point aPoint(aPixPos.getX(), aPixPos.getY());
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index b87f00ae6f00..a9aeffec8550 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -380,11 +380,6 @@ public:
 #define CHECK_FOR_DEFUNC( ifc )                                             \
     CHECK_FOR_DEFUNC_THIS( ifc, this )
 
-#define CHECK_FOR_WINDOW( i, w )                                            \
-    if( !(w) )                                                              \
-    {                                                                       \
-        THROW_RUNTIME_EXCEPTION( i, "window is missing" );                  \
-    }
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index c332ea858d31..9b5558f295c6 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -230,8 +230,10 @@ awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
         SolarMutexGuard aGuard;
 
         vcl::Window *pWin = GetWindow();
-
-        CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+        if (!pWin)
+        {
+            throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+        }
 
         Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
         awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
@@ -250,8 +252,10 @@ awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
     SolarMutexGuard aGuard;
 
     vcl::Window *pWin = GetWindow();
-
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     Point aPixPos( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ).TopLeft() );
     awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
@@ -264,8 +268,10 @@ css::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen()
     SolarMutexGuard aGuard;
 
     vcl::Window *pWin = GetWindow();
-
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     Point aPixPos( pWin->GetWindowExtentsRelative( nullptr ).TopLeft() );
     awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
@@ -278,8 +284,10 @@ css::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
     SolarMutexGuard aGuard;
 
     vcl::Window *pWin = GetWindow();
-
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     Size aPixSize( pWin->GetWindowExtentsRelative( nullptr ).GetSize() );
     awt::Size aSize( aPixSize.Width(), aPixSize.Height() );
@@ -293,8 +301,10 @@ sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
     SolarMutexGuard aGuard;
 
     vcl::Window *pWin = GetWindow();
-
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     Rectangle aPixBounds( pWin->GetWindowExtentsRelative( nullptr ) );
     aPixBounds.Move(-aPixBounds.Left(), -aPixBounds.Top());
@@ -313,7 +323,10 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAt
         CHECK_FOR_DEFUNC( XAccessibleComponent )
 
         vcl::Window *pWin = GetWindow();
-        CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+        if (!pWin)
+        {
+            throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+        }
 
         Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to window
         if( mpChildWin->GetWindowExtentsRelative( pWin ).IsInside( aPixPoint ) )
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 0c4e43ef46b1..358472664edf 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1381,7 +1381,10 @@ css::uno::Sequence< css::style::TabStop > SwAccessibleParagraph::GetCurrentTabSt
     {
         // translate core coordinates into accessibility coordinates
         vcl::Window *pWin = GetWindow();
-        CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+        if (!pWin)
+        {
+            throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+        }
 
         SwRect aTmpRect(0, 0, tabs[0].Position, 0);
 
@@ -2360,7 +2363,10 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
 
     // translate core coordinates into accessibility coordinates
     vcl::Window *pWin = GetWindow();
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
 
     Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect.SVRect() ));
     SwRect aFrameLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
@@ -2396,7 +2402,10 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
 
     // construct Point (translate into layout coordinates)
     vcl::Window *pWin = GetWindow();
-    CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+    if (!pWin)
+    {
+        throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+    }
     Point aPoint( rPoint.X, rPoint.Y );
     SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root
     Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
@@ -3527,7 +3536,10 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
                 const SwRect& aCursorCoreRect = pCursorShell->GetCharRect();
                 // translate core coordinates into accessibility coordinates
                 vcl::Window *pWin = GetWindow();
-                CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+                if (!pWin)
+                {
+                    throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+                }
 
                 Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect.SVRect() ));
 
commit a18fa6973fbfac8f9da738a2fbc5da3cb698d108
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 17:06:36 2017 +0100

    sw: convert to assert in SwAccessiblePage
    
    Change-Id: I3bb8430be2460fa72938a4952670d3d92b12e123

diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx
index 91a7e3f0d58b..68908380ed7b 100644
--- a/sw/source/core/access/accpage.cxx
+++ b/sw/source/core/access/accpage.cxx
@@ -113,9 +113,9 @@ SwAccessiblePage::SwAccessiblePage(std::shared_ptr<SwAccessibleMap> const& pInit
     : SwAccessibleContext( pInitMap, AccessibleRole::PANEL, pFrame )
     , bIsSelected( false )
 {
-    OSL_ENSURE( pFrame != nullptr, "need frame" );
-    OSL_ENSURE( pInitMap != nullptr, "need map" );
-    OSL_ENSURE( pFrame->IsPageFrame(), "need page frame" );
+    assert(pFrame != nullptr);
+    assert(pInitMap != nullptr);
+    assert(pFrame->IsPageFrame());
 
     OUString sPage = OUString::number(
         static_cast<const SwPageFrame*>( GetFrame() )->GetPhyPageNum() );
commit f8a3748c9bac4b323a6eea8b079949c82af8703e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 17:03:31 2017 +0100

    sw: remove SolarMutexGuards from SwAccessible* constructors
    
    Clearly the mutex must be locked by the caller already.
    
    Change-Id: I2c8a76f5b04751610ed07819343994b75bea4f4f

diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index a33276248b08..85b733f74bcd 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -104,7 +104,6 @@ SwAccessibleCell::SwAccessibleCell(std::shared_ptr<SwAccessibleMap> const& pInit
     , m_aSelectionHelper( *this )
     , m_bIsSelected( false )
 {
-    SolarMutexGuard aGuard;
     OUString sBoxName( pCellFrame->GetTabBox()->GetName() );
     SetName( sBoxName );
 
diff --git a/sw/source/core/access/accfootnote.cxx b/sw/source/core/access/accfootnote.cxx
index 5faefac2f2f1..f28fef02dd46 100644
--- a/sw/source/core/access/accfootnote.cxx
+++ b/sw/source/core/access/accfootnote.cxx
@@ -47,8 +47,6 @@ SwAccessibleFootnote::SwAccessibleFootnote(
         bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE,
         pFootnoteFrame )
 {
-    SolarMutexGuard aGuard;
-
     sal_uInt16 nResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME
                                    : STR_ACCESS_FOOTNOTE_NAME;
 
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index 8329ff586e6b..53572cbd1deb 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -130,8 +130,6 @@ SwAccessibleFrameBase::SwAccessibleFrameBase(
     SwAccessibleContext( pInitMap, nInitRole, pFlyFrame ),
     bIsSelected( false )
 {
-    SolarMutexGuard aGuard;
-
     const SwFrameFormat *pFrameFormat = pFlyFrame->GetFormat();
     const_cast< SwFrameFormat * >( pFrameFormat )->Add( this );
 
diff --git a/sw/source/core/access/accheaderfooter.cxx b/sw/source/core/access/accheaderfooter.cxx
index f32a0b8b0d14..683c02bf93dd 100644
--- a/sw/source/core/access/accheaderfooter.cxx
+++ b/sw/source/core/access/accheaderfooter.cxx
@@ -40,8 +40,6 @@ SwAccessibleHeaderFooter::SwAccessibleHeaderFooter(
         const SwHeaderFrame* pHdFrame    ) :
     SwAccessibleContext( pInitMap, AccessibleRole::HEADER, pHdFrame )
 {
-    SolarMutexGuard aGuard;
-
     OUString sArg( OUString::number( pHdFrame->GetPhyPageNum() ) );
     SetName( GetResource( STR_ACCESS_HEADER_NAME, &sArg ) );
 }
@@ -51,8 +49,6 @@ SwAccessibleHeaderFooter::SwAccessibleHeaderFooter(
         const SwFooterFrame* pFtFrame    ) :
     SwAccessibleContext( pInitMap, AccessibleRole::FOOTER, pFtFrame )
 {
-    SolarMutexGuard aGuard;
-
     OUString sArg( OUString::number( pFtFrame->GetPhyPageNum() ) );
     SetName( GetResource( STR_ACCESS_FOOTER_NAME, &sArg ) );
 }
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index bfd93796c63b..0d4a083b6ac0 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1838,6 +1838,7 @@ uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview(
 uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame,
                                                      bool bCreate )
 {
+    DBG_TESTSOLARMUTEX();
     uno::Reference < XAccessible > xAcc;
     uno::Reference < XAccessible > xOldCursorAcc;
     bool bOldShapeSelected = false;
diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx
index 2486fc630e50..91a7e3f0d58b 100644
--- a/sw/source/core/access/accpage.cxx
+++ b/sw/source/core/access/accpage.cxx
@@ -117,8 +117,6 @@ SwAccessiblePage::SwAccessiblePage(std::shared_ptr<SwAccessibleMap> const& pInit
     OSL_ENSURE( pInitMap != nullptr, "need map" );
     OSL_ENSURE( pFrame->IsPageFrame(), "need page frame" );
 
-    SolarMutexGuard aGuard;
-
     OUString sPage = OUString::number(
         static_cast<const SwPageFrame*>( GetFrame() )->GetPhyPageNum() );
     SetName( GetResource( STR_ACCESS_PAGE_NAME, &sPage ) );
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index b5185abd15ba..0c4e43ef46b1 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -544,8 +544,6 @@ SwAccessibleParagraph::SwAccessibleParagraph(
     , mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTextFrame ) ) // #i108125#
     , m_bLastHasSelection(false)  //To add TEXT_SELECTION_CHANGED event
 {
-    SolarMutexGuard aGuard;
-
     bIsHeading = IsHeading();
     //Get the real heading level, Heading1 ~ Heading10
     nHeadingLevel = GetRealHeadingLevel();
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index b237242f3d62..6e324781367e 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -767,8 +767,6 @@ SwAccessibleTable::SwAccessibleTable(
     SwAccessibleContext( pInitMap, AccessibleRole::TABLE, pTabFrame ),
     mpTableData( nullptr )
 {
-    SolarMutexGuard aGuard;
-
     const SwFrameFormat *pFrameFormat = pTabFrame->GetFormat();
     const_cast< SwFrameFormat * >( pFrameFormat )->Add( this );
 
@@ -1070,6 +1068,8 @@ uno::Reference< XAccessibleTable > SAL_CALL
 uno::Reference< XAccessibleTable > SAL_CALL
         SwAccessibleTable::getAccessibleColumnHeaders(  )
 {
+    SolarMutexGuard aGuard;
+
     // #i87532# - assure that return accessible object is empty,
     // if no column header exists.
     SwAccessibleTableColHeaders* pTableColHeaders =
commit cd2b96e2d166d2a3ec074cdae029a51bc3d401f4
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 17:02:49 2017 +0100

    sw: remove unnecessary ifdef
    
    Change-Id: Ifa0a036589fba816eaa3503b17223e80f5b99aa1

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 6986a7260fc0..bfd93796c63b 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1741,9 +1741,8 @@ SwAccessibleMap::~SwAccessibleMap()
 
     {
         osl::MutexGuard aGuard( maEventMutex );
-#if OSL_DEBUG_LEVEL > 0
-        assert(!(mpEvents || mpEventMap));
-#endif
+        assert(!mpEvents);
+        assert(!mpEventMap);
         delete mpEventMap;
         mpEventMap = nullptr;
         delete mpEvents;
commit 14189f6db434724954cd1b85659d460c7b39be83
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 16:45:19 2017 +0100

    sw: fix incorrect static_cast in ~SwAccessibleMap
    
    Change-Id: I43aef41cee96f69b0bbd540b832780c4002219e3

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 1c51ac6fbc05..6986a7260fc0 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1668,7 +1668,8 @@ SwAccessibleMap::~SwAccessibleMap()
 
     if(xAcc.is())
     {
-        SwAccessibleDocument *pAcc = static_cast< SwAccessibleDocument * >( xAcc.get() );
+        SwAccessibleDocumentBase *const pAcc =
+            static_cast<SwAccessibleDocumentBase *>(xAcc.get());
         pAcc->Dispose( true );
     }
 #if OSL_DEBUG_LEVEL > 0
commit 8cae63caf04e4ba555af13c022dab9dfe9c79dcf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 24 16:28:36 2017 +0100

    sw: remove unnecessary ClearMapPointer calls from ~SwAccessibleMap
    
    These are unnecessary with the fix for tdf#58624, because now
    SwAccessibleContext dtor will check that the map is still
    alive.
    
    Anything that's still alive at that point should have been disposed
    by the recursive Dispose call.
    
    Change-Id: I39102a6b222b2121987d92077d4b9548281d9973

diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index f2288a51a3b6..c125729c0bec 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -1429,14 +1429,6 @@ OUString SwAccessibleContext::GetResource( sal_uInt16 nResId,
     return sStr;
 }
 
-
-void SwAccessibleContext::ClearMapPointer()
-{
-    DBG_TESTSOLARMUTEX();
-    m_pMap = nullptr;
-    m_wMap.reset();
-}
-
 void SwAccessibleContext::RemoveFrameFromAccessibleMap()
 {
     assert(m_refCount > 0); // must be alive to do this without using m_wMap
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index d37bb8e7768d..b87f00ae6f00 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -59,6 +59,9 @@ class SwAccessibleContext :
     // 'externalized' and wants access to the protected members like
     // GetMap, GetChild, GetParent, and GetFrame.
     friend class SwAccessibleSelectionHelper;
+#if OSL_DEBUG_LEVEL > 0
+    friend class SwAccessibleMap;
+#endif
 
 protected:
     mutable ::osl::Mutex m_Mutex;
@@ -167,7 +170,6 @@ protected:
     virtual void InvalidateFocus_();
 
 public:
-    void ClearMapPointer();
     void FireAccessibleEvent( css::accessibility::AccessibleEventObject& rEvent );
 
 protected:
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 5acee3a62889..1c51ac6fbc05 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1671,6 +1671,7 @@ SwAccessibleMap::~SwAccessibleMap()
         SwAccessibleDocument *pAcc = static_cast< SwAccessibleDocument * >( xAcc.get() );
         pAcc->Dispose( true );
     }
+#if OSL_DEBUG_LEVEL > 0
     if( mpFrameMap )
     {
         SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->begin();
@@ -1680,12 +1681,12 @@ SwAccessibleMap::~SwAccessibleMap()
             if( xTmp.is() )
             {
                 SwAccessibleContext *pTmp = static_cast< SwAccessibleContext * >( xTmp.get() );
-                // TODO is this still needed
-                pTmp->ClearMapPointer();
+                assert(pTmp->GetMap() == nullptr); // must be disposed
             }
             ++aIter;
         }
     }
+#endif
     {
         osl::MutexGuard aGuard( maMutex );
 #if OSL_DEBUG_LEVEL > 0


More information about the Libreoffice-commits mailing list