Bug 158281 - Writer does not open DOCX correctly, objects jumbled on first page, freezes
Summary: Writer does not open DOCX correctly, objects jumbled on first page, freezes
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: high major
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Layout-Loops, Writer-Loops DOCX-Opening
  Show dependency treegraph
Reported: 2023-11-20 10:24 UTC by BRANDT
Modified: 2024-03-22 01:38 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

result after open document as png and the docx document (8.51 MB, application/x-zip-compressed)
2023-11-20 10:24 UTC, BRANDT
The extracted example file (9.45 MB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-11-20 19:00 UTC, Gabor Kelemen (allotropia)

Note You need to log in before you can comment on or make changes to this bug.
Description BRANDT 2023-11-20 10:24:57 UTC
Created attachment 190918 [details]
result after open document as png and the docx document


When i try to open a docx document i have all informations from all pages on the first page and writer doesn't answer after.
Comment 1 BogdanB 2023-11-20 10:38:43 UTC
Confirm with
Version: (X86_64) / LibreOffice Community
Build ID: 2c71560cf64499365e803f710c788d033da0e5e9
CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 2 Gabor Kelemen (allotropia) 2023-11-20 19:00:52 UTC
Created attachment 190922 [details]
The extracted example file
Comment 3 Gabor Kelemen (allotropia) 2023-11-20 19:02:51 UTC
This looked pretty good in 7.3, 173 pages vs 172 in Word. Then it broke sometime in the 7.4 cycle: layout loop and drawing shapes on top of each other on the first page.
Comment 4 BogdanB 2023-11-21 19:36:21 UTC
 0d1ffc14abf43c7830cee6369710d8e63e2fd0ef is the first bad commit
commit 0d1ffc14abf43c7830cee6369710d8e63e2fd0ef
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Wed Jul 13 09:36:47 2022 +0200

    source 44eef5f494825a26594ba3d50ef1f3211ae73b9b
    source 44eef5f494825a26594ba3d50ef1f3211ae73b9b

 instdir/program/libswlo.so           | Bin 23140160 -> 23135904 bytes
 instdir/program/libwriterfilterlo.so | Bin 3501792 -> 3501584 bytes
 instdir/program/setuprc              |   2 +-
 instdir/program/versionrc            |   2 +-
 4 files changed, 2 insertions(+), 2 deletions(-)

author	Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu>	2022-06-20 17:27:53 +0200
committer	László Németh <nemeth@numbertext.org>	2022-07-13 09:25:10 +0200
commit 44eef5f494825a26594ba3d50ef1f3211ae73b9b (patch)
tree 4efca7d4e590d5910dc54d9dd4cb0f5a2b5b0c24
parent 641cefc22bd38c8ebe702ed2caf704711a5ee607 (diff)
tdf#148687 tdf#149173 tdf#149546 sw: fix crash with textboxes
Regression from 2110597ac730fa07dbbdd603fda82b182ed27c9e
"tdf#147485 sw: fix group shape crash using std::shared_ptr".


1) Using reference instead of copy assignment in SwTextBoxHelper.

2) Cleanup: Unused parts of SwTextBoxHelper were removed.

3) Fixing destruction of textboxes, in case when first the shape
is removed, with clearing all textboxes from the doc and the shape
before the pointer is released. All of this only have to be done if
the call is not coming from the swdoc dtor, unless there will be
double freeing.

4) Missing style conversion was fixed in writerfilter.

5) Don't import sections in textboxes, unless the hack of dummy
paragraph before tables in sections will be applied and the paragraph
with anchored objects inside will be removed with the objects;

6) ConvertTextRangeToTextFrame also fixed, so embed frames in
frames are imported from now. (Also textboxes in frames, this
can be useful when there is a floating table having group
textbox with nested complex content inside, or floating table
in floating table, etc...) Note: Follow up commit will enable
group textbox import in frames and tables.

7) Import of group textboxes with complex content in header/footer
was impossible, from now this is also supported both from DOCX and
ODT (test included).

8) Guard class for blocking unwanted recursive textbox sync
has been introduced, and maybe some speedup with group
textbox import has been achieved.

9) The anchor sync method got a new function which avoids
unnecessary sync when the anchor is the same.

10) Sync of As_char textboxes during layout calculation caused
crash so that has a workaround from now, for DOCX import anchor
change and Undo. That syncs starts before the layout calculation
so sync not needed later.

11) A memory leak was found in Undo, which has been fixed.

Note: layout test "testTdf147485Forcepoint" has to be limited
to Windows and Mac builds, because font substitution
causes crash on the Unix based systems.

Change-Id: I69d5d79cc120e3a70ba9285be32ec36a434b2a04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136192
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 1d3d2a995239c3c71432006cb795324c56a0412a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136929
Tested-by: Jenkins
Comment 5 Stéphane Guillou (stragu) 2024-03-22 01:38:48 UTC
Still current in:

Version: (X86_64) / LibreOffice Community
Build ID: 53c5d570cab036b23f4969b858a648c8f0c24f93
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Jumbled objects on first page; freezes, have to kill it to exit. Setting severity to "major".