[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sc/inc sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 30 08:21:13 PDT 2012


 sc/inc/dpobject.hxx                |    2 +-
 sc/source/core/data/dpobject.cxx   |   12 +++++++++---
 sc/source/ui/docshell/dbdocfun.cxx |    3 ++-
 3 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit c3148ae81b8458624b7ee829d34629dea29f8cdf
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Aug 30 10:36:57 2012 -0400

    fdo#53938: Check for null pointer, and don't proceed when error occurs.
    
    This prevents the crash, the same error dialog from appearing 3 times in
    a row, and also prevents the pivot table outout from becoming empty on
    error condition.
    
    Change-Id: I09a72f78561f3f0446a95732fb9c242c1144878a
    Signed-off-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 86aa8aa..272b459 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -245,7 +245,7 @@ public:
      * Remove in the save data entries for members that don't exist anymore.
      * This is called during pivot table refresh.
      */
-    void SyncAllDimensionMembers();
+    bool SyncAllDimensionMembers();
 
     static bool         HasRegisteredSources();
     static com::sun::star::uno::Sequence<rtl::OUString> GetRegisteredSources();
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index c21dfb6..f4b39ff 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -705,21 +705,27 @@ void ScDPObject::BuildAllDimensionMembers()
     pSaveData->BuildAllDimensionMembers(GetTableData());
 }
 
-void ScDPObject::SyncAllDimensionMembers()
+bool ScDPObject::SyncAllDimensionMembers()
 {
     if (!pSaveData)
-        return;
+        return false;
 
     // #i111857# don't always create empty mpTableData for external service.
     // Ideally, xSource should be used instead of mpTableData.
     if (pServDesc)
-        return;
+        return false;
 
     ScDPTableData* pData = GetTableData();
+    if (!pData)
+        // No table data exists.  This can happen when refreshing from an
+        // external source which doesn't exist.
+        return false;
+
     // Refresh the cache wrapper since the cache may have changed.
     pData->SetEmptyFlags(pSaveData->GetIgnoreEmptyRows(), pSaveData->GetRepeatIfEmpty());
     pData->ReloadCacheTable();
     pSaveData->SyncAllDimensionMembers(pData);
+    return true;
 }
 
 bool ScDPObject::GetMemberNames( sal_Int32 nDim, Sequence<OUString>& rNames )
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 4cb5620..e424763 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1472,7 +1472,8 @@ sal_uLong ScDBDocFunc::RefreshPivotTables(ScDPObject* pDPObj, bool bApi)
     for (; it != itEnd; ++it)
     {
         ScDPObject* pObj = *it;
-        pObj->SyncAllDimensionMembers();
+        if (!pObj->SyncAllDimensionMembers())
+            continue;
 
         // This action is intentionally not undoable since it modifies cache.
         DataPilotUpdate(pObj, pObj, false, bApi);


More information about the Libreoffice-commits mailing list