Bug Hunting Session
Bug 76633 - RTF import: for image an additional Rectangle Drawing Object is inserted in the document
Summary: RTF import: for image an additional Rectangle Drawing Object is inserted in t...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.5.3 release
Hardware: Other All
: medium normal
Assignee: Michael Stahl (CIB)
URL:
Whiteboard: BSA target:4.4.0 target:4.3.0.1 targe...
Keywords: filter:rtf, regression
: 60375 77597 77981 (view as bug list)
Depends on:
Blocks: RTF Shapes
  Show dependency treegraph
 
Reported: 2014-03-26 12:44 UTC by t.zwart
Modified: 2017-09-27 01:52 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Incorrect lines showing when adding an image (644.35 KB, application/rtf)
2014-03-31 09:41 UTC, t.zwart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description t.zwart 2014-03-26 12:44:16 UTC
Problem description: 

If you add an image to a .rtf file, save it and then re-open the file you get some sort of square or rectangle in the top left corner (see the attachment for an example). Even when you remove this, save and re-open the file it will reappear. This seems to only happen when you add an image to the file. 

Steps to reproduce:
1. Create a .rtf file.
2. Add an image.
3. Save the file as .rtf.
4. Re-open the file.

Current behavior:
Extra lines that souldn't be there

Expected behavior:
No extra lines
              
Operating System: Windows 8
Version: 4.2.0.4 release
Comment 1 t.zwart 2014-03-31 09:41:55 UTC
Created attachment 96645 [details]
Incorrect lines showing when adding an image
Comment 2 Andras Timar 2014-03-31 13:12:50 UTC
Reproducible in 4.1.5.3, not reproducible in 4.0.0.3 -> regression.
Comment 3 Andras Timar 2014-03-31 13:26:43 UTC
Only on Windows!
Comment 4 Andras Timar 2014-04-22 10:14:05 UTC
*** Bug 77597 has been marked as a duplicate of this bug. ***
Comment 5 Yousuf Philips (jay) (retired) 2014-04-22 10:49:13 UTC
My bug is not an rtf image bug, its a rtf full document bug. If it has been fixed, please provide a build i can test against.
Comment 6 Robinson Tryon (qubit) 2014-04-22 18:29:11 UTC
CONFIRMED on Ubuntu 12.04.4 + LO 4.2.3.3

(In reply to comment #0)
> Steps to reproduce:
> 1. Create a .rtf file.
> 2. Add an image.
> 3. Save the file as .rtf.
> 4. Re-open the file.
> 
> Current behavior:
> Extra lines that s[h]ouldn't be there

I see the "some sort of square or rectangle in the top left corner" just as described in comment 0.

(In reply to comment #3)
> Only on Windows!

Nope -- this happens on GNU/Linux as well.

(OS -> All)
Comment 7 Andras Timar 2014-04-22 18:45:46 UTC
(In reply to comment #6)
> 
> Nope -- this happens on GNU/Linux as well.

32-bit or 64-bit?
Comment 8 Robinson Tryon (qubit) 2014-04-22 19:05:57 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > 
> > Nope -- this happens on GNU/Linux as well.
> 
> 32-bit or 64-bit?

$ uname -a
Linux loopbackoffice 3.8.0-37-generic #53~precise1-Ubuntu SMP Wed Feb 19 21:37:54 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I can dig up someone to test on OSX, too if that would be helpful?
Comment 9 Andras Timar 2014-04-22 19:09:23 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > 
> > > Nope -- this happens on GNU/Linux as well.
> > 
> > 32-bit or 64-bit?
> 
> $ uname -a
> Linux loopbackoffice 3.8.0-37-generic #53~precise1-Ubuntu SMP Wed Feb 19
> 21:37:54 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> 
> I can dig up someone to test on OSX, too if that would be helpful?

No, thanks. I could not reproduce the bug on 64-bit openSUSE, but it does not matter. Hopefully we have enough information for vmiklos, who will most probably fix this bug.
Comment 10 Michael Stahl (CIB) 2014-06-12 17:31:57 UTC
can reproduce this (Linux) on 4.2, but not on 4.1

bibisect range:
3cf0b5cdb05e1d77610431b1b1328102bf05b602..ea4fc480c7317b16f4abbafacda3872bb7413357

regression from:

commit 9f1f7199736e2ae07b34849ba66f61a1ef5782e8
Author:     Miklos Vajna <vmiklos@suse.cz>
AuthorDate: Fri Aug 9 15:03:08 2013 +0200

    fdo#53556 RTF import: fix handling of default shapeType
    

... oddly that commit was backported to 4.1 too but that works-for-me
Comment 11 Michael Stahl (CIB) 2014-06-13 11:01:07 UTC
actually the root cause exists since LO 3.5, the commit in comment #10
just changes it from invisible to the user to visible,
the problem is that an SwXShape is created and then leaked,
which can be checked by "x = thiscomponent.getDrawPage.getByIndex(1)"

(gdb) bt
#0  SwXShape::SwXShape (this=0x45bcbc0, xShape=uno::Reference to (SvxCustomShape *) 0x42dd618) at /sw/source/core/unocore/unodraw.cxx:902
#1  0x00007f637115d97a in SwXTextDocument::create (this=0x41f0830, rServiceName="com.sun.star.drawing.CustomShape", arguments=0x0) at /sw/source/uibase/uno/unotxdoc.cxx:1719
#2  0x00007f637115daa3 in SwXTextDocument::createInstance (this=0x41f0830, rServiceName="com.sun.star.drawing.CustomShape") at /sw/source/uibase/uno/unotxdoc.cxx:1727
#3  0x00007f634aaaa81a in writerfilter::rtftok::RTFSdrImport::createShape (this=0x3c205f0, aStr="com.sun.star.drawing.CustomShape", xShape=empty uno::Reference, xPropertySet=empty uno::Reference) at /writerfilter/source/rtftok/rtfsdrimport.cxx:69
#4  0x00007f634aaab852 in writerfilter::rtftok::RTFSdrImport::resolve (this=0x3c205f0, rShape=..., bClose=true, shapeOrPict=writerfilter::rtftok::RTFSdrImport::PICT) at /writerfilter/source/rtftok/rtfsdrimport.cxx:229
#5  0x00007f634aa6c404 in writerfilter::rtftok::RTFDocumentImpl::popState (this=0x39fc730) at /writerfilter/source/rtftok/rtfdocumentimpl.cxx:4845
#6  0x00007f634aabe063 in writerfilter::rtftok::RTFTokenizer::resolveParse (this=0x3c205a0) at /writerfilter/source/rtftok/rtftokenizer.cxx:115
#7  0x00007f634aa538e7 in writerfilter::rtftok::RTFDocumentImpl::resolve (this=0x39fc730, rMapper=...) at /writerfilter/source/rtftok/rtfdocumentimpl.cxx:674
#8  0x00007f634abeafc2 in RtfFilter::filter (this=0x45ace30, aDescriptor=uno::Sequence of length 13 = {...}) at /writerfilter/source/filter/RtfFilter.cxx:122
Comment 12 Michael Stahl (CIB) 2014-06-13 13:32:23 UTC
fixed on master.
Comment 13 Commit Notification 2014-06-13 13:33:02 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b7857e5cfe9d5d007785ae93e5505620fc8ed475

fdo#76633: writerfilter RTF import: disappear the rectangle shapes on images



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2014-06-13 13:33:21 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ba9b63d8101197d3fd8612193b1ca188271dfc1a

fdo#76633: writerfilter: RTF import: do not leak the XShape of image



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2014-06-13 13:43:57 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e2cf3ef783a824b0a5733040db91e6ca3eb247b2&h=libreoffice-4-3

fdo#76633: writerfilter RTF import: disappear the rectangle shapes on images


It will be available in LibreOffice 4.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2014-06-13 13:44:17 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=83de5fe9c3161b9bfe655306253fc760fc64e8f3&h=libreoffice-4-3

fdo#76633: writerfilter: RTF import: do not leak the XShape of image


It will be available in LibreOffice 4.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 17 Michael Stahl (CIB) 2014-06-13 19:24:41 UTC
*** Bug 77981 has been marked as a duplicate of this bug. ***
Comment 18 Michael Stahl (CIB) 2014-06-13 19:35:38 UTC
*** Bug 77597 has been marked as a duplicate of this bug. ***
Comment 19 Yousuf Philips (jay) (retired) 2014-06-13 20:15:55 UTC
Hey Michael,

Look forward to test this fix, so i can test to see if my bug 77597 is a duplicate. I'm assuming the fix wont be landing in 4.2.
Comment 20 Yousuf Philips (jay) (retired) 2014-06-13 20:44:25 UTC
(In reply to comment #11)
> actually the root cause exists since LO 3.5, the commit in comment #10
> just changes it from invisible to the user to visible,
> the problem is that an SwXShape is created and then leaked,
> which can be checked by "x = thiscomponent.getDrawPage.getByIndex(1)"

Quite weird that it went back since then and didnt show up till 4.2. I just went through exporting RTFs of a gallery image for 3.6 to 4.3 for bug 79974 and you can see the results in attachment 100975 [details] and attachment 100976 [details].
Comment 21 Commit Notification 2014-06-14 11:11:44 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e9f78d3e9b6d961cefbe47e5a4b4ff7c9e6a2b73&h=libreoffice-4-2

fdo#76633: writerfilter RTF import: disappear the rectangle shapes on images


It will be available in LibreOffice 4.2.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 22 Yousuf Philips (jay) (retired) 2014-06-17 22:18:44 UTC
Hi Michael,

Well i tested my bug 77597 on the latest 4.3 and happy to say that it doesnt take up half the page anymore, but noticed that RTFs dont save page breaks in 4.3 and 4.4 [bug 80167].
Comment 23 Robinson Tryon (qubit) 2015-12-17 12:37:56 UTC Comment hidden (obsolete)
Comment 24 Miklos Vajna 2016-06-10 14:12:02 UTC
*** Bug 60375 has been marked as a duplicate of this bug. ***