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

Michael Stahl mstahl at redhat.com
Fri Feb 26 12:12:45 UTC 2016


 sw/inc/crsrsh.hxx                    |    6 +++---
 sw/inc/fesh.hxx                      |    4 ++--
 sw/source/core/access/acccontext.cxx |   23 ++++++++++++++++++++++-
 sw/source/core/access/accmap.cxx     |   10 +++++-----
 sw/source/core/crsr/crsrsh.cxx       |    4 ++--
 sw/source/core/frmedt/fecopy.cxx     |    2 +-
 sw/source/core/frmedt/fews.cxx       |    8 ++++----
 sw/source/core/layout/layact.cxx     |    4 ++--
 sw/source/uibase/uiview/view1.cxx    |    4 ++--
 sw/source/uibase/uiview/view2.cxx    |    6 +++---
 10 files changed, 46 insertions(+), 25 deletions(-)

New commits:
commit d0b09f41efe938e94a84e783c9ff5742edcbfba8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Feb 23 20:59:30 2016 +0100

    sw: related: tdf#58624 convert to assert() in ~SwAccessibleMap()
    
    With the restored Dispose() calls from previous commit these don't
    trigger on every scrolled document now.
    
    Change-Id: I93694352adadc2c3a034be949d4930de51ec80e9

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 7ea16d4..aa00caa 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1700,8 +1700,8 @@ SwAccessibleMap::~SwAccessibleMap()
     {
         osl::MutexGuard aGuard( maMutex );
 #if OSL_DEBUG_LEVEL > 0
-        OSL_ENSURE( !mpFrameMap || mpFrameMap->empty(),
-                "Frame map should be empty after disposing the root frame" );
+        assert((!mpFrameMap || mpFrameMap->empty()) &&
+                "Frame map should be empty after disposing the root frame");
         if( mpFrameMap )
         {
             SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->begin();
@@ -1717,8 +1717,8 @@ SwAccessibleMap::~SwAccessibleMap()
                 ++aIter;
             }
         }
-        OSL_ENSURE( !mpShapeMap || mpShapeMap->empty(),
-                "Object map should be empty after disposing the root frame" );
+        assert((!mpShapeMap || mpShapeMap->empty()) &&
+                "Object map should be empty after disposing the root frame");
         if( mpShapeMap )
         {
             SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->begin();
@@ -1751,7 +1751,7 @@ SwAccessibleMap::~SwAccessibleMap()
     {
         osl::MutexGuard aGuard( maEventMutex );
 #if OSL_DEBUG_LEVEL > 0
-        OSL_ENSURE( !(mpEvents || mpEventMap), "pending events" );
+        assert(!(mpEvents || mpEventMap));
         if( mpEvents )
         {
             SwAccessibleEventList_Impl::iterator aIter = mpEvents->begin();
commit b299aa7c64adc2de86c367888e6ccb73c4b31bc2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 25 23:24:53 2016 +0100

    sw: restore some Dispose calls in a11y code
    
    These were removed by commit a5c4ddcf8ed5344d9bceeffd7431cd6895a407ca
    but the assertions inevitably triggered by their removal in the
    ~SwAccessibleMap about "Frame map should be empty after disposing the
    root frame" were left intact, which (along the total lack of any stated
    reason) casts some doubt on how well thought out that change was.
    
    Basically SwAccessibleMap had the invariant that only visible frames had
    a valid SwAccessible in the mpFrameMap, and when the frames scrolled
    out of view their SwAccessible was disposed.
    
    Let's try to restore this invariant.
    
    The dispose removal has caused crashes in the past too, see
    commit 104ed86c382b73505b477bf3024982dd27823023.
    
    Change-Id: I4b3e7264ce76a8c6e551d68f6bc231982970dfdd

diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 0e42527..86d34cd 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -240,6 +240,11 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrame *pFrame,
                                 xAccImpl->ViewForwarderChanged(
                                     ::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
                                     GetMap() );
+                                // this DisposeShape call was removed by
+                                // IAccessibility2 implementation
+                                // without giving any reason why
+                                DisposeShape( rLower.GetDrawObject(),
+                                          xAccImpl.get() );
                             }
                             break;
                         // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
@@ -347,6 +352,11 @@ void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
     // It might be that the child is freshly created just to send
     // the child event. In this case no listener will exist.
     FireStateChangedEvent( AccessibleStateType::SHOWING, false );
+
+    // this Dispose call was removed by IAccessibility2 implementation
+    // without giving any reason why - without it we get stale
+    // entries in SwAccessibleMap::mpFrameMap.
+    Dispose(true);
 }
 
 // #i27301# - use new type definition for <_nStates>
@@ -1140,7 +1150,18 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
     // note: InvalidatePosOrSize must call _InvalidateContent so that
     // SwAccessibleParagraph updates its portions, or dispose it
     // (see accmap.cxx: INVALID_CONTENT is contained in POS_CHANGED)
-    _InvalidateContent( true );
+    if( !bIsNewShowingState &&
+        SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
+    {
+        // this Dispose call was removed by IAccessibility2 implementation
+        // without giving any reason why - without it we get stale
+        // entries in SwAccessibleMap::mpFrameMap.
+        Dispose(true);
+    }
+    else
+    {
+        _InvalidateContent( true );
+    }
 }
 
 void SwAccessibleContext::InvalidateChildPosOrSize(
commit c4727a06fe16ed88f2c293aaa3506df8e6523678
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 25 22:21:52 2016 +0100

    sw: we don't have space to spell out "focus" in ShLooseFcs...
    
    ...but we *do* have the space to mis-spell "lose".
    
    Change-Id: I0cb55d616dfee614e82975b7b3c25a0dcc37d0d7

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index aefacf2..f3850eb 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -448,9 +448,9 @@ public:
      * On the other hand, on receiving the focus all selected ranges are displayed again
      * (ranges must be recalculated!).
      */
-    bool HasShFcs() const { return m_bHasFocus; }
-    void ShLooseFcs();
-    void ShGetFcs( bool bUpdate = true );
+    bool HasShellFocus() const { return m_bHasFocus; }
+    void ShellLoseFocus();
+    void ShellGetFocus( bool bUpdate = true );
 
     // Methods for displaying or hiding the visible text cursor.
     void ShowCursor();
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 3ee1857..27ce4a6 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -591,8 +591,8 @@ public:
     Point GetRelativePagePosition(const Point& rDocPos);
 
     /// Hide or show layout-selection and pass call to CursorSh.
-    void ShLooseFcs();
-    void ShGetFcs( bool bUpdate = true );
+    void ShellLoseFocus();
+    void ShellGetFocus( bool bUpdate = true );
 
     /// PageDescriptor-interface
     void   ChgCurPageDesc( const SwPageDesc& );
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index d4bff23..88f7fe2 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2176,14 +2176,14 @@ void SwCursorShell::HideCursor()
     }
 }
 
-void SwCursorShell::ShLooseFcs()
+void SwCursorShell::ShellLoseFocus()
 {
     if( !m_bBasicHideCursor )
         HideCursors();
     m_bHasFocus = false;
 }
 
-void SwCursorShell::ShGetFcs( bool bUpdate )
+void SwCursorShell::ShellGetFocus( bool bUpdate )
 {
     m_bHasFocus = true;
     if( !m_bBasicHideCursor && VisArea().Width() )
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index dc7939d..5c95c4d4 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -567,7 +567,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt,
                 }
             }
 
-            if( this != pDestShell && !pDestShell->HasShFcs() )
+            if (this != pDestShell && !pDestShell->HasShellFocus())
                 pDestShell->Imp()->GetDrawView()->hideMarkHandles();
         }
     }
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index b5fb023..658b0bb 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -275,10 +275,10 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons
     return nReturn;
 }
 
-void SwFEShell::ShGetFcs( bool bUpdate )
+void SwFEShell::ShellGetFocus( bool bUpdate )
 {
     ::SetShell( this );
-    SwCursorShell::ShGetFcs( bUpdate );
+    SwCursorShell::ShellGetFocus( bUpdate );
 
     if ( HasDrawView() )
     {
@@ -288,9 +288,9 @@ void SwFEShell::ShGetFcs( bool bUpdate )
     }
 }
 
-void SwFEShell::ShLooseFcs()
+void SwFEShell::ShellLoseFocus()
 {
-    SwCursorShell::ShLooseFcs();
+    SwCursorShell::ShellLoseFocus();
 
     if ( HasDrawView() && Imp()->GetDrawView()->AreObjectsMarked() )
     {
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 4b02607..66a914e 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2236,9 +2236,9 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) :
                         // to fill the virtual device. This fill don't have
                         // paint the selection! -> Set the focus flag at
                         // CursorShell and it doesn't paint the selection.
-                        pCursorShell->ShLooseFcs();
+                        pCursorShell->ShellLoseFocus();
                         pCursorShell->UnlockPaint( true );
-                        pCursorShell->ShGetFcs( false );
+                        pCursorShell->ShellGetFocus( false );
                     }
                     else
                         rSh.UnlockPaint( true );
diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx
index 3f9b047..a65e31d 100644
--- a/sw/source/uibase/uiview/view1.cxx
+++ b/sw/source/uibase/uiview/view1.cxx
@@ -71,7 +71,7 @@ void SwView::Activate(bool bMDIActivate)
 
     if ( bMDIActivate )
     {
-        m_pWrtShell->ShGetFcs(false);     // Selections visible
+        m_pWrtShell->ShellGetFocus(false);     // Selections visible
 
         if( !m_sSwViewData.isEmpty() )
         {
@@ -123,7 +123,7 @@ void SwView::Deactivate(bool bMDIActivate)
 
     if( bMDIActivate )
     {
-        m_pWrtShell->ShLooseFcs();    // Selections invisible
+        m_pWrtShell->ShellLoseFocus();    // Selections invisible
 
         m_pHRuler->SetActive( false );
         m_pVRuler->SetActive( false );
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 075802f..84f06ec9 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1925,9 +1925,9 @@ bool SwView::JumpToSwMark( const OUString& rMark )
         SetCursorAtTop( true );
 
         // For scrolling the FrameSet, the corresponding shell needs to have the focus.
-        bool bHasShFocus = m_pWrtShell->HasShFcs();
+        bool bHasShFocus = m_pWrtShell->HasShellFocus();
         if( !bHasShFocus )
-            m_pWrtShell->ShGetFcs( false );
+            m_pWrtShell->ShellGetFocus( false );
 
         const SwFormatINetFormat* pINet;
         OUString sCmp;
@@ -2047,7 +2047,7 @@ bool SwView::JumpToSwMark( const OUString& rMark )
         SetCursorAtTop( bSaveCT, bSaveCC );
 
         if( !bHasShFocus )
-            m_pWrtShell->ShLooseFcs();
+            m_pWrtShell->ShellLoseFocus();
     }
     return bRet;
 }


More information about the Libreoffice-commits mailing list