[Libreoffice-commits] core.git: sc/source

Stephan Bergmann sbergman at redhat.com
Thu Oct 1 06:11:13 PDT 2015


 sc/source/ui/Accessibility/AccessibleDocument.cxx |   24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 6f1e77fc600f776433a759172323b4afec3d811e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Sep 21 15:35:09 2015 +0200

    rhbz#1264753: Avoid this being release()ed to 0 in ScAccessibleDocument ctor
    
    ...where the most plausible explanation for the bug's crash from within
    ScGridWindow::CreateAccessible appears to be that the call to
    
      xAcc = new ScAccessibleEditObject(this, ...)
    
    which stores "this" as a css::uno::Reference in the ScAccessibleEditObject, can
    cause xAcc to be deleted synchronously from within the ScAccessibleDocument
    ctor, causing the ScAccessibleDocument instance itself to also be deleted.
    
    So re-use the existing ScAccessibleDocument::Init (already properly called at
    the only place that instantiates ScAccessibleDocument, in
    ScGridWindow::CreateAccessible) to defer any initialization that uses "this",
    and hope that the resulting slight re-ordering of when certain initialization
    code is executed does not cause problems.
    
    Change-Id: I524a1659394e8900b7d33de358fdd4baf647c083
    Reviewed-on: https://gerrit.libreoffice.org/18750
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 9fe0208..0022e9d 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1412,10 +1412,15 @@ ScAccessibleDocument::ScAccessibleDocument(
     mpTempAccEdit(NULL),
     mbCompleteSheetSelected(false)
 {
-    if (pViewShell)
+    maVisArea = GetVisibleArea_Impl();
+}
+
+void ScAccessibleDocument::Init()
+{
+    if (mpViewShell)
     {
-        pViewShell->AddAccessibilityObject(*this);
-        vcl::Window *pWin = pViewShell->GetWindowByPos(eSplitPos);
+        mpViewShell->AddAccessibilityObject(*this);
+        vcl::Window *pWin = mpViewShell->GetWindowByPos(meSplitPos);
         if( pWin )
         {
             pWin->AddChildEventListener( LINK( this, ScAccessibleDocument, WindowChildEventListener ));
@@ -1428,20 +1433,15 @@ ScAccessibleDocument::ScAccessibleDocument(
                     AddChild( pChildWin->GetAccessible(), false );
             }
         }
-        ScViewData& rViewData = pViewShell->GetViewData();
-        if (rViewData.HasEditView(eSplitPos))
+        ScViewData& rViewData = mpViewShell->GetViewData();
+        if (rViewData.HasEditView(meSplitPos))
         {
-            uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, rViewData.GetEditView(eSplitPos),
-                pViewShell->GetWindowByPos(eSplitPos), GetCurrentCellName(), GetCurrentCellDescription(),
+            uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, rViewData.GetEditView(meSplitPos),
+                mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(), GetCurrentCellDescription(),
                 ScAccessibleEditObject::CellInEditMode);
             AddChild(xAcc, false);
         }
     }
-    maVisArea = GetVisibleArea_Impl();
-}
-
-void ScAccessibleDocument::Init()
-{
     if(!mpChildrenShapes)
         mpChildrenShapes = new ScChildrenShapes(this, mpViewShell, meSplitPos);
 }


More information about the Libreoffice-commits mailing list