Bug 156349 - LibreOffice hangs when floating table gets caption below
Summary: LibreOffice hangs when floating table gets caption below
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.0.1 rc
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:24.2.0 target:7.6.1
Keywords: bibisectRequest, regression
Depends on:
Blocks: Caption DOCX-Floatingtable
  Show dependency treegraph
 
Reported: 2023-07-18 11:28 UTC by Regina Henschel
Modified: 2023-08-08 20:42 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Floating table on one page (22.41 KB, application/zip)
2023-07-18 11:28 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2023-07-18 11:28:30 UTC
Created attachment 188431 [details]
Floating table on one page

open attached file.
Set cursor into table.
From context menu call Insert Caption.
Add caption "Numbers English-German" with position _below_.
=> LibreOffice hangs

Tested with Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: fcbae818b793a9ee97a1b5ddc53902be7a2376f5
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 1 Miklos Vajna 2023-07-18 12:39:56 UTC
Yes, I can reproduce, SwFrame::GetNextFlyLeaf() never finishes.

An additional problem is the limits of the DOCX format here, because that doesn't support captions on floating tables.

Two fixes I can think of:

1) if the frame only contains one table and is allowed to split, then hide the UI to insert a caption because the resulting document won't be something you can save back to DOCX, because of the limits of the format. (We'll save it as a shape, containing the table + the caption, but won't be able to split across pages.)

or

2) if the frame contains more than just a table and the user marks it as "split across pages", then ignore this request during rendering and still keep the table on a single page.

I believe any of these would fix your problem; perhaps 1) is better? I guess it's annoying if our UI allows creating documents that you can't save back later.
Comment 2 Stéphane Guillou (stragu) 2023-07-18 12:48:17 UTC
Miklos beat me to it, but for what it's worth:

Confirmed with same steps in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 77fca616e0bd79e0b405fd0b3543cf8e94e15df3
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

and:

Version: 7.6.0.1 (X86_64) / LibreOffice Community
Build ID: 776eaf34564cbf3f034a0ba1fd1d5c32ff9ccf1c
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

No hang if caption text is empty. Seems dependent on the string length, and only hangs when it needs to wrap over more than on line.

No hang in:

Version: 7.5.4.2 (X86_64) / LibreOffice Community
Build ID: 36ccfdc35048b057fd9854c757a8b67ec53977b6
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Flatpak
Calc: threaded
Comment 3 Stéphane Guillou (stragu) 2023-07-18 12:51:43 UTC
(note also the following undo issue: if the short caption is successfully added, a Ctrl + Z won't remove the frame)
Comment 4 Commit Notification 2023-08-03 07:31:21 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/107de1a2c6882213cf0ef6783417302f43cdada0

tdf#156349 sw floattable: fix caption insert for tables inside split fly frames

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2023-08-04 08:24:50 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/41060a937c529247c0d4f815228bb1e21803de60

tdf#156349 sw floattable: fix caption insert for tables inside split fly frames

It will be available in 7.6.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Stéphane Guillou (stragu) 2023-08-08 20:36:30 UTC
Thanks Michael, fix verified in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 42364fbfafaa95773c073cc080142b64ec1786fb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded