Bug 479942 - Okular crashes when saving a document
Summary: Okular crashes when saving a document
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 24.01.90
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-17 12:37 UTC by Kotori Itsuka
Modified: 2024-01-25 22:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
crash caught in gdb (42.93 KB, text/plain)
2024-01-17 12:37 UTC, Kotori Itsuka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kotori Itsuka 2024-01-17 12:37:04 UTC
Created attachment 164978 [details]
crash caught in gdb

SUMMARY
Saving a Form 4 (Queensland) document with two particular checkboxes checked will result in a crash. This only seems to happen with this document and with these checkboxes.

STEPS TO REPRODUCE
1. Download https://www.publications.qld.gov.au/ckan-publications-attachments-prod/resources/56b091a2-4c65-48a0-99e1-01661c4d9e77/form-4-advance-health-directive-queensland.pdf?ETag=2d1d93c9b87bdc6db996ddb5107cdc71
2. Open with Okular
3. Scroll down to section 4
4. Check Option 3 ("I cannot decide at this point") and Option 4 ("I give the following specific directions")
5. Save

OBSERVED RESULT
Program Crashes

EXPECTED RESULT
File saves

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch Linux with kde-unstable repo
(available in About System)
KDE Plasma Version: 5.92.0
KDE Frameworks Version: 5.248.0
Qt Version: 6.7.0
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Sometimes it will popup a messagebox saying it cannot open the file, but the application will freeze.
Comment 1 Sune Vuorela 2024-01-17 13:15:49 UTC
Also reproducible in 22.12.
Comment 2 Sune Vuorela 2024-01-17 14:53:53 UTC
So. I guess I need to discuss this with Albert and maybe read the pdf standard. 
The following becomes a bit technical:

But apparantly the 4 options is in a 'button group' and okular assumes that all buttons on a button group is in the same page. But 4 is  on a page of itself. And Okular gets confused by this (and EditFormButtonsCommand::refreshInternalPageReferences fails (It looks for the form elements on the wrong page) to succeed) and after that, okular seems to be in a bad state and starts crashing.
Comment 3 Sune Vuorela 2024-01-17 17:37:53 UTC
not qt6 specific, bug janitor.
Comment 4 Bug Janitor Service 2024-01-17 19:00:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/915
Comment 5 Albert Astals Cid 2024-01-25 22:14:57 UTC
Git commit 12e40e0d360f9912eee1b162d61e3f183676ea5a by Albert Astals Cid, on behalf of Sune Vuorela.
Committed on 25/01/2024 at 23:14.
Pushed by aacid into branch 'master'.

Button groups can span multiple pages

The code needs to be aware of that.

M  +17   -2    core/documentcommands.cpp
M  +1    -0    core/documentcommands_p.h
M  +13   -2    part/formwidgets.cpp

https://invent.kde.org/graphics/okular/-/commit/12e40e0d360f9912eee1b162d61e3f183676ea5a
Comment 6 Albert Astals Cid 2024-01-25 22:17:35 UTC
Git commit f0e98bd5315232f7dc86edc1002d7fdf22181413 by Albert Astals Cid, on behalf of Sune Vuorela.
Committed on 25/01/2024 at 23:17.
Pushed by aacid into branch 'release/24.02'.

Button groups can span multiple pages

The code needs to be aware of that.
(cherry picked from commit 12e40e0d360f9912eee1b162d61e3f183676ea5a)

M  +17   -2    core/documentcommands.cpp
M  +1    -0    core/documentcommands_p.h
M  +13   -2    part/formwidgets.cpp

https://invent.kde.org/graphics/okular/-/commit/f0e98bd5315232f7dc86edc1002d7fdf22181413