Bug 45522: rtf export, Crash when copying table between Writer and other LibreOffice programs

Caolán McNamara caolanm at redhat.com
Wed Mar 21 08:31:13 PDT 2012

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

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sw.check.table.haslayout.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120321/1e77f944/attachment.bin>

More information about the LibreOffice mailing list