Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On Thu, 2012-03-08 at 17:23 +0100, Dézsi Szabolcs wrote:
Hi!

https://bugs.freedesktop.org/show_bug.cgi?id=45522

There's an attached odt file with a table in it. Copying the table to
other LO programs (Calc, etc) causes LO to crash.
After inspection I realized that the problem is in
sw/source/core/table/swtable.cxx
There is a struct definition in that file SwTableCellInfo::Impl with a
void setTable(const SwTable * pTable) method.

So, I had a look at this as well. Here's what I think the situation
is....

The cut and paste goes through the writer rtf exporter, so we're talking
about crashes in the rtf exporter. 

Tables are miserably complicated in writer, and for complex tables I see
that we try and take the layout information for the tables when
available to use for exporting to rtf/doc. That only works if the
document has been laid out though, and the temporary clipboard document
isn't laid out, so yeah, that's going to return a NULL and crash
horribly. Situation doesn't arise in .doc export as we don't cut and
paste .doc format, but we do .rtf

My first thought was a quick hack like the attached to use
processSwTableByLayout only if the table has layout information and use
the other branch otherwise.

That gets us past the first crash, but then the rtf exporter breaks and
falls over later on, possibly because its hard to get the table
structure right without the layout information.

I don't think we can call MakeFrms on a table to generate layout
information in isolation without the full document being laid out (or
can we?) so I guess we have to suck it down and fix the second layer of
crashes in the .rtf exporter with the alternative table export branch.

C.
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index e97de42..6473986 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -326,6 +326,8 @@ public:
 #ifdef DBG_UTIL
     void CheckConsistency() const;
 #endif
+
+    bool HasLayout() const;
 };
 
 class SW_DLLPUBLIC SwTableLine: public SwClient     // Client of FrmFmt.
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 3c0b4c1..c5f0d09 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2800,6 +2800,13 @@ void SwTable::RegisterToFormat( SwFmt& rFmt )
     rFmt.Add( this );
 }
 
+bool SwTable::HasLayout() const
+{
+    const SwFrmFmt* pFrmFmt = GetFrmFmt();
+    //a table in a clipboard document doesn't have any layout information
+    return pFrmFmt && SwIterator<SwTabFrm,SwFmt>::FirstElement(*pFrmFmt);
+}
+
 void SwTableLine::RegisterToFormat( SwFmt& rFmt )
 {
     rFmt.Add( this );
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index 72993ba..7df6abc 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -631,8 +631,7 @@ void WW8TableInfo::processSwTable(const SwTable * pTable)
 
     WW8TableNodeInfo * pPrev = NULL;
 
-    SwFrmFmt * pFrmFmt = pTable->GetFrmFmt();
-    if (pFrmFmt != NULL && pTable->IsTblComplex())
+    if (pTable->IsTblComplex() && pTable->HasLayout())
     {
         pPrev = processSwTableByLayout(pTable);
 

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.