Bug 40599 - paragraph anchored graphics in redlined list duplicated on each save
Summary: paragraph anchored graphics in redlined list duplicated on each save
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.3 release
Hardware: x86 (IA32) All
: medium normal
Assignee: Michael Stahl (CIB)
URL:
Whiteboard: target:3.6.0 target:3.5.1
Keywords: regression
Depends on:
Blocks: 46482
  Show dependency treegraph
 
Reported: 2011-09-03 05:41 UTC by tka
Modified: 2013-06-23 21:23 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Load this document, save it again and the number of <draw> tags double (41.97 KB, application/vnd.oasis.opendocument.text)
2011-09-03 05:41 UTC, tka
Details
smaller reproducer (40.33 KB, application/vnd.oasis.opendocument.text)
2011-09-14 01:57 UTC, Caolán McNamara
Details
this is what I'd like to do (865 bytes, patch)
2011-09-15 00:45 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tka 2011-09-03 05:41:10 UTC
Created attachment 50866 [details]
Load this document, save it again and the number of <draw> tags double

I'm editing a file with a few drawings. After a few sessions, it appears
that the file is corrupted and the Libre Office crashes (so does Open Office
too). To see what was happening, I looked content.xml  inside the odt file. 
And what's interesting: one of the images embedded using <draw> tag was
cloned 2048 times. 
The number 2048 (2 ^ 11) is not accidental. I checked that each save the
file doubles the number of tags <draw> referring to the same object.
Comment 1 Caolán McNamara 2011-09-13 08:49:29 UTC
This seems very familiar, I'm sure we've encountered this bug before.
Comment 2 Caolán McNamara 2011-09-13 16:14:48 UTC
It's the (incredibly annoying) change tracking. A breakpoint on SwGrfNode::SwGrfNode and toggleing redlines off and on should add graphic nodes per toggle
Comment 3 Caolán McNamara 2011-09-14 01:57:57 UTC
Created attachment 51183 [details]
smaller reproducer

Here's an easier reproducer, i.e. load this, F5 and expand graphics, there is 1 listed, save as, and even without re-loading a new graphic will appear in the graphics list. 

Seems the temp copy of the redline stuff during export creates a copy of the graphic which isn't deleted when the redline section is removed again. Something of that nature anyway
Comment 4 Caolán McNamara 2011-09-14 08:04:50 UTC
Some thinking out loud via unit tests for graphic deletion http://cgit.freedesktop.org/libreoffice/core/commit/?id=8578e3c80d99da0b47cd450a9be61cef28f411b0
Comment 5 Caolán McNamara 2011-09-15 00:45:49 UTC
Created attachment 51228 [details]
this is what I'd like to do

This would fix it, but potentially with side-effects.
Comment 6 Björn Michaelsen 2011-12-23 12:35:34 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 7 Not Assigned 2012-02-22 15:10: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=23e52c207760c596cc2f841ef59f3100c110d591

fdo#40599 i#112763: fix frame duplication:
Comment 8 Michael Stahl (CIB) 2012-02-22 15:20:45 UTC
used to work in OOo 3.1.1, broke in OOo 3.2 => regression

this was introduced with the following change in CWS os131:

SwDoc::CopyFlyInFlyImpl:

-             pAPos->nNode < rRg.aEnd )
+             pAPos->nNode <= rRg.aEnd )

the problem happens on Show/Hide redlines.
there is also OOo issue 112763 which is essentially a duplicate.

@Caolán: i don't like the attached patch because i have no idea
what problems it could cause; since the redlining already
sets a special flag that is used for comparing the start position
i found it expedient to use it for comparing the end position too.

fixed on master.
Comment 9 Caolán McNamara 2012-02-23 02:20:59 UTC
great you found a fix.

re attached patch, yeah, I never committed it because its more an aside along the lines of "this is the way I want the world to work" than a fix
Comment 10 Not Assigned 2012-02-23 07:23:10 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ab55f25ecad89e05a440770cfc8c87320ae010ef&g=libreoffice-3-5

fdo#40599 i#112763: fix frame duplication:


It will be available in LibreOffice 3.5.2.
Comment 11 Not Assigned 2012-02-24 06:24:46 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-3-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=eda71e73a401458acdb58a26841791de1d23c2c5&g=libreoffice-3-5-1

fdo#40599 i#112763: fix frame duplication:


It will be available already in LibreOffice 3.5.1.