[Libreoffice-commits] .: 2 commits - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jan 14 20:24:27 PST 2011


 sc/inc/document.hxx              |    1 -
 sc/inc/dpobject.hxx              |    6 ++----
 sc/source/core/data/dpobject.cxx |   29 +++++++++++++++++++++++------
 sc/source/core/data/makefile.mk  |    4 ++++
 4 files changed, 29 insertions(+), 11 deletions(-)

New commits:
commit 1039649b648c5c40092c629de47a84cffa555cbf
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Jan 14 23:22:23 2011 -0500

    Very unfortunate workaround for stlport, to prevent crash.
    
    When using stlport, ptr_vector crashes when calling erase when the
    container only contains one element.  In such cases, calling clear
    instead won't crash.  Very ugly, but what can we do...

diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8680428..abb22d2 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2423,6 +2423,17 @@ ScDPCollection::~ScDPCollection()
 
 void ScDPCollection::DeleteOnTab( SCTAB nTab )
 {
+#ifdef STLPORT_WORKAROUND
+    // We do this only because STLPort crashes when erasing an element when
+    // the container only contains one element.
+    if (maTables.size() == 1)
+    {
+        if (maTables.back().GetOutRange().aStart.Tab() == nTab)
+            maTables.clear();
+        return;
+    }
+#endif
+
     TablesType::iterator itr = maTables.begin(), itrEnd = maTables.end();
     while (itr != itrEnd)
     {
@@ -2629,6 +2640,18 @@ void ScDPCollection::FreeTable(ScDPObject* pDPObj)
     const ScAddress& s = rOutRange.aStart;
     const ScAddress& e = rOutRange.aEnd;
     pDoc->RemoveFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), SC_MF_DP_TABLE);
+#ifdef STLPORT_WORKAROUND
+    // We do this only because STLPort crashes when erasing an element when
+    // the container only contains one element.
+    if (maTables.size() == 1)
+    {
+        if (&maTables.back() == pDPObj)
+        {
+            maTables.clear();
+            return;
+        }
+    }
+#endif
     TablesType::iterator itr = maTables.begin(), itrEnd = maTables.end();
     for (; itr != itrEnd; ++itr)
     {
diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk
index efb3fca..1fbcd3c 100644
--- a/sc/source/core/data/makefile.mk
+++ b/sc/source/core/data/makefile.mk
@@ -43,6 +43,10 @@ AUTOSEG=true
 
 # --- Files --------------------------------------------------------
 
+.IF "$(USE_SYSTEM_STL)"!="YES"
+CFLAGSCXX+=-DSTLPORT_WORKAROUND
+.ENDIF
+
 SLOFILES =  \
     $(EXCEPTIONSFILES) \
     $(EXCEPTIONSNOOPTFILES) \
commit 1cb096dfbc62f05809f99e86eb4c223e911a444a
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Jan 14 22:31:30 2011 -0500

    ScDPObject no longer has to be a child class of ScDataObject.

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a11d2bd..462cc14 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -148,7 +148,6 @@ class ScRowBreakIterator;
 struct ScSetStringParam;
 class ScDocRowHeightUpdater;
 struct ScColWidthParam;
-class ScDPTableDataCache;
 struct ScCopyBlockFromClipParams;
 
 namespace com { namespace sun { namespace star {
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 9982089..e33a11a 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -91,7 +91,7 @@ struct ScDPServiceDesc
 };
 
 
-class SC_DLLPUBLIC ScDPObject : public ScDataObject
+class SC_DLLPUBLIC ScDPObject
 {
 private:
     ScDocument*				pDoc;
@@ -128,9 +128,7 @@ public:
     ULONG RefreshCache();
                 ScDPObject( ScDocument* pD );
                 ScDPObject(const ScDPObject& r);
-    virtual		~ScDPObject();
-
-    virtual	ScDataObject*	Clone() const;
+                ~ScDPObject();
 
     /**
      * When a DP object is "alive", it has table output on a sheet.  This flag
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index fa8fb4a..8680428 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -177,7 +177,6 @@ ScDPObject::ScDPObject( ScDocument* pD ) :
 }
 
 ScDPObject::ScDPObject(const ScDPObject& r) :
-    ScDataObject(),
     pDoc( r.pDoc ),
     pSaveData( NULL ),
     aTableName( r.aTableName ),
@@ -219,11 +218,6 @@ ScDPObject::~ScDPObject()
     InvalidateSource();
 }
 
-ScDataObject* ScDPObject::Clone() const
-{
-    return new ScDPObject(*this);
-}
-
 void ScDPObject::SetAlive(BOOL bSet)
 {
     bAlive = bSet;


More information about the Libreoffice-commits mailing list