Bug 71310 - FILEOPEN: FILESAVE: docx image caption numbering displayed incorrectly
Summary: FILEOPEN: FILESAVE: docx image caption numbering displayed incorrectly
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-06 16:09 UTC by Jorendc
Modified: 2014-04-21 10:10 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorendc 2013-11-06 16:09:27 UTC
How to reproduce:

* Download https://www.libreoffice.org/bugzilla/attachment.cgi?id=80191
* Open it using LibreOffice
* File > Save
* Re-save it with another name as .docx
* Close
* Re-open it

Behavior: at the first seconds when the file is loaded, the figure numbers are correctly showed ('figure 1' for the first picture, 'figure 2' for the second). But a second afterwards, 'figure 2' changes to 'figure 1'. So in general the number is correctly imported, but is recalculated somehow which result in an incorrect figure number.

Tested on 3 independent computers; Windows 7 x64, windows 8 x64 and Linux Mint 15 x64 (build today). 
All with master Version: 4.2.0.0.alpha0+
Build ID: bfaea05b711ff3e204429ce9bd26c5fe63b0b687
TinderBox: Win-x86@42, Branch:master, Time: 2013-10-24_00:06:20

Kind regards,
Joren
Comment 1 Jorendc 2013-11-06 16:17:57 UTC
Log on IRC with instructions related to this problem:

[17:02] <@vmiklos> jorendc: aha. so after the import on the first "onfocus" event some field is updated. that happens in writerfilter/source/dmapper/ModelEventListener.cxx. my first try would be to see if i disable everything in notifyEvent(), see if that helps.
[17:02] <@vmiklos> jorendc: if so, then the cached result of the field is OK, but not the field instruction, that's why you get bad results after the field update.
[17:03] <@vmiklos> if you look into the docx file manually, that may help to decide if the field instruction is already wrong (export problem), or that's ok, then you have an import problem.
Comment 2 Jorendc 2013-11-06 16:31:53 UTC
The exported file from LibreOffice opens correctly using Microsoft Word 2010.
Comment 3 Jorendc 2013-11-06 16:56:40 UTC
The bad behavior happens somewhere in SwLayIdle::_DoIdleJob (sw/source/core/layout/layact.cxx).
Placing all code of that function in comments result in 'good behavior'.
Comment 4 Jorendc 2013-11-06 20:15:05 UTC
I ended up somewhere in vcl and svx.

Caolan: Any thoughts about this one? Looks like repainting is the cause of this problem. The whole repaining starts in SwLayIdle. I ended in my quest to hunt this down in SalGraphics::CopyBits , without result :s (there CopyBits is called again and again, as C++ noob this really weird :) ). But Probably I took somewhere the wrong 'track' in the code, which result in ending there.

Kind regards,
Joren
Comment 5 Jorendc 2013-11-06 20:16:17 UTC
@Caolan: forgot you to add you in CC when posting comment 4. ^^ Sorry for the noise.
Comment 6 Jorendc 2014-04-21 10:10:35 UTC
Not reproducible anymore, tested using Mac OSX 10.9 with LibreOffice Version: 4.3.0.0.alpha0+
Build ID: 619b4c40da9e85febbb08a3f7cf8aa8d10963fc1
TinderBox: MacOSX-x86@49-TDF, Branch:master, Time: 2014-04-18_00:07:53