Bug 467603 - Okular crashed when using the 'Save Form' button in a PDF form
Summary: Okular crashed when using the 'Save Form' button in a PDF form
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 22.12.3
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2023-03-20 12:00 UTC by Aidan Coombs
Modified: 2023-04-06 20:52 UTC (History)
2 users (show)

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


Attachments
Australian Government form (425.05 KB, application/pdf)
2023-03-29 00:47 UTC, Aidan Coombs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aidan Coombs 2023-03-20 12:00:29 UTC
Application: okular (22.12.3)

Qt Version: 5.15.8
Frameworks Version: 5.104.0
Operating System: Linux 6.2.7-zen1-1-zen x86_64
Windowing System: X11
Distribution: Arch Linux
DrKonqi: 5.27.3 [KCrashBackend]

-- Information about the crash:
BACKGROUND
I was filling out a PDF form in Okular after having used the 'Show Forms' button in the View menu so I could fill stuff out. It was all going relatively well until I got to the end of the form, where there were three buttons: Print Form, Save Form, and Reset Form. Attempting to save my form using the 'Save Form' button crashed Okular.
STEPS TO REPRODUCE
1. Open a PDF document with forms, including a 'Save' form control.
2. Use View > Show Forms to make the fields editable.
3. Click the 'Save' form control. When presented with the standard file-saving dialog, save the file as anything, anywhere on your computer.
4. Once you click the Save button in the dialog, Okular will appear to immediately crash. The file, however, will be saved perfectly where you asked it to be. Any changes you made to the fields (i.e. the fields you filled in) will be preserved in this saved version.
WORKAROUND
Use the 'Save' or 'Save As' menu options from the Okular UI.
FURTHER INFORMATION
The PDF form I was using was, according to Okular's File > Properties function:
- Created by Adobe InDesign CC 2014
- Produced by Adobe PDF Library 11.0
- Unencrypted
- In format PDF v1.6
- Not optimised
- Including a number of embedded fonts, of types Type 1C, TrueType, and CID TrueType; some substitutions with fonts from my local machine were made.

The crash can be reproduced every time.

-- Backtrace:
Application: Okular (okular), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  0x00007f0d741357c5 in std::__atomic_base<int>::load (__m=std::memory_order_relaxed, this=0x7f0d000005cb) at /usr/include/c++/12.2.1/bits/atomic_base.h:488
#7  QAtomicOps<int>::loadRelaxed<int> (_q_value=<error reading variable: Cannot access memory at address 0x7f0d000005cb>) at /usr/include/qt/QtCore/qatomic_cxx11.h:239
#8  QBasicAtomicInteger<int>::loadRelaxed (this=0x7f0d000005cb) at /usr/include/qt/QtCore/qbasicatomic.h:107
#9  QtPrivate::RefCount::ref (this=0x7f0d000005cb) at /usr/include/qt/QtCore/qrefcount.h:55
#10 QVector<Okular::Action*>::QVector (v=..., this=0x7ffd10de4c60) at /usr/include/qt/QtCore/qvector.h:374
#11 Okular::Action::nextActions (this=0x556e03bf5da0) at /usr/src/debug/okular/okular-22.12.3/core/action.cpp:69
#12 0x00007f0d7417b0ec in Okular::Document::processAction (this=0x556e03687390, action=<optimized out>) at /usr/src/debug/okular/okular-22.12.3/core/document.cpp:4295
#13 0x00007f0d824bea71 in QtPrivate::QSlotObjectBase::call (a=<optimized out>, r=<optimized out>, this=<optimized out>, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#14 doActivate<false> (sender=0x556e039a8f70, signal_index=15, argv=0x7ffd10de4dc0) at kernel/qobject.cpp:3923
#15 0x00007f0d742940b7 in FormWidgetsController::action (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/okular/build/okularpart_autogen/EAH7DXM7NH/moc_formwidgets.cpp:446
#16 0x00007f0d74311bd4 in FormWidgetsController::signalAction (a=0x556e03bf5da0, this=<optimized out>) at /usr/src/debug/okular/okular-22.12.3/part/formwidgets.cpp:73
#17 PushButtonEdit::mouseReleaseEvent (event=0x7ffd10de5320, this=0x556e03bbce90) at /usr/src/debug/okular/okular-22.12.3/part/formwidgets.cpp:1253
#18 PushButtonEdit::mouseReleaseEvent (this=0x556e03bbce90, event=0x7ffd10de5320) at /usr/src/debug/okular/okular-22.12.3/part/formwidgets.cpp:1253
#19 0x00007f0d831af837 in QWidget::event (this=0x556e03bbce90, event=0x7ffd10de5320) at kernel/qwidget.cpp:8671
#20 0x00007f0d83178b5c in QApplicationPrivate::notify_helper (this=this@entry=0x556e031dece0, receiver=receiver@entry=0x556e03bbce90, e=e@entry=0x7ffd10de5320) at kernel/qapplication.cpp:3640
#21 0x00007f0d8317e379 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffd10de5320) at kernel/qapplication.cpp:3084
#22 0x00007f0d8248df48 in QCoreApplication::notifyInternal2 (receiver=0x556e03bbce90, event=0x7ffd10de5320) at kernel/qcoreapplication.cpp:1064
#23 0x00007f0d8248dfd3 in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#24 0x00007f0d8317c377 in QApplicationPrivate::sendMouseEvent (receiver=0x556e03bbce90, event=0x7ffd10de5320, alienWidget=<optimized out>, nativeWidget=0x556e033798c0, buttonDown=<optimized out>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2622
#25 0x00007f0d831cd505 in QWidgetWindow::handleMouseEvent (this=this@entry=0x556e037a34f0, event=event@entry=0x7ffd10de5680) at kernel/qwidgetwindow.cpp:683
#26 0x00007f0d831cf2ae in QWidgetWindow::event (this=0x556e037a34f0, event=0x7ffd10de5680) at kernel/qwidgetwindow.cpp:300
#27 0x00007f0d83178b5c in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x556e037a34f0, e=0x7ffd10de5680) at kernel/qapplication.cpp:3640
#28 0x00007f0d8248df48 in QCoreApplication::notifyInternal2 (receiver=0x556e037a34f0, event=0x7ffd10de5680) at kernel/qcoreapplication.cpp:1064
#29 0x00007f0d8248dfd3 in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#30 0x00007f0d8293efbc in QGuiApplicationPrivate::processMouseEvent (e=0x556e04517770) at kernel/qguiapplication.cpp:2285
#31 0x00007f0d82928885 in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#32 0x00007f0d7d52e8d0 in xcbSourceDispatch (source=<optimized out>) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:105
#33 0x00007f0d80d0fafb in g_main_dispatch (context=0x7f0d78000ee0) at ../glib/glib/gmain.c:3460
#34 g_main_context_dispatch (context=0x7f0d78000ee0) at ../glib/glib/gmain.c:4200
#35 0x00007f0d80d6c5d9 in g_main_context_iterate.constprop.0 (context=0x7f0d78000ee0, block=1, dispatch=1, self=<optimized out>) at ../glib/glib/gmain.c:4276
#36 0x00007f0d80d0d382 in g_main_context_iteration (context=0x7f0d78000ee0, may_block=1) at ../glib/glib/gmain.c:4343
#37 0x00007f0d824d8c6c in QEventDispatcherGlib::processEvents (this=0x556e033259a0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#38 0x00007f0d824866ec in QEventLoop::exec (this=0x7ffd10de5a20, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#39 0x00007f0d82491219 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#40 0x00007f0d82939fe2 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1870
#41 0x00007f0d83176f2a in QApplication::exec () at kernel/qapplication.cpp:2832
#42 0x0000556e0294e882 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/okular/okular-22.12.3/shell/main.cpp:111
[Inferior 1 (process 38607) detached]

Reported using DrKonqi
Comment 1 Albert Astals Cid 2023-03-28 13:26:20 UTC
We're going to need the file
Comment 2 Aidan Coombs 2023-03-29 00:47:27 UTC
Created attachment 157676 [details]
Australian Government form

The PDF I was having issues with. The 'Save Form' button crashes Okular.
Comment 3 Bug Janitor Service 2023-03-29 21:19:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/711
Comment 4 Albert Astals Cid 2023-04-05 22:23:41 UTC
Git commit c62dc60ead273b1eb285bdb5665fa14769d59888 by Albert Astals Cid.
Committed on 05/04/2023 at 22:06.
Pushed by aacid into branch 'master'.

Fix crash when executing the Save action

Detecting aboutToClose is not enough because savingAs doesn't always go
through aboutToClose it can go through swapBackingFile

M  +29   -4    core/document.cpp

https://invent.kde.org/graphics/okular/commit/c62dc60ead273b1eb285bdb5665fa14769d59888
Comment 5 Albert Astals Cid 2023-04-05 22:24:45 UTC
Git commit 91bcb4cc21d6701ce266073a4194c94f2d735a7d by Albert Astals Cid.
Committed on 05/04/2023 at 22:24.
Pushed by aacid into branch 'release/23.04'.

Fix crash when executing the Save action

Detecting aboutToClose is not enough because savingAs doesn't always go
through aboutToClose it can go through swapBackingFile
(cherry picked from commit c62dc60ead273b1eb285bdb5665fa14769d59888)

M  +29   -4    core/document.cpp

https://invent.kde.org/graphics/okular/commit/91bcb4cc21d6701ce266073a4194c94f2d735a7d