Created attachment 137664 [details] okular-forms-bug-2021-04-16_17.49.58.mp4 SUMMARY Okular shows the [object Object] popup and crashes. STEPS TO REPRODUCE 1. Download https://www.ftb.ca.gov/forms/2020/2020-540.pdf 2. Repeat steps like on the attached screenshot video (TAB causes the popup) OBSERVED RESULT Bogus popup and then crash. SOFTWARE/OS VERSIONS KDE Plasma Version: 5.80.0 KDE Frameworks Version: 5.80.0 Qt Version: 5.15.2 FreeBSD 12.2
Okular shows "[object Object]" warning for the "Date of Birth" field (other fields work fine) and does not crash here. Okular 21.07.70 (self-compiled from git/master).
Can you please attach a backtrace of the crash? See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
(gdb) r 2020-540.pdf Starting program: /usr/local/bin/okular 2020-540.pdf [New LWP 102128 of process 61131] [New LWP 102156 of process 61131] [New LWP 102216 of process 61131] [New LWP 102218 of process 61131] [LWP 102218 of process 61131 exited] [Detaching after fork from child process 61132] [New LWP 101104 of process 61131] [New LWP 102220 of process 61131] [LWP 101104 of process 61131 exited] [New LWP 102223 of process 61131] [LWP 102220 of process 61131 exited] [New LWP 101153 of process 61131] [LWP 102223 of process 61131 exited] [New LWP 101753 of process 61131] [LWP 101153 of process 61131 exited] [New LWP 101094 of process 61131] [LWP 101753 of process 61131 exited] [New LWP 102069 of process 61131] [LWP 101094 of process 61131 exited] [New LWP 102225 of process 61131] [LWP 102069 of process 61131 exited] [New LWP 102226 of process 61131] [LWP 102225 of process 61131 exited] [New LWP 102227 of process 61131] [LWP 102226 of process 61131 exited] [New LWP 102125 of process 61131] [LWP 102227 of process 61131 exited] [LWP 102125 of process 61131 exited] [New LWP 101211 of process 61131] [New LWP 101738 of process 61131] [LWP 101211 of process 61131 exited] [LWP 101738 of process 61131 exited] evaluate() threw an exception qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 9917, resource id: 19783597, major code: 40 (TranslateCoords), minor code: 0 [New LWP 101181 of process 61131] [LWP 101181 of process 61131 exited] [New LWP 102228 of process 61131] [LWP 102228 of process 61131 exited] evaluate() threw an exception qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 14290, resource id: 19784129, major code: 40 (TranslateCoords), minor code: 0 [New LWP 102232 of process 61131] [New LWP 102234 of process 61131] [LWP 102232 of process 61131 exited] [LWP 102234 of process 61131 exited] Thread 1 received signal SIGSEGV, Segmentation fault. 0x00000008088b7a87 in ?? () from /usr/local/lib/libOkular5Core.so.9 (gdb) bt #0 0x00000008088b7a87 in ?? () from /usr/local/lib/libOkular5Core.so.9 #1 0x00000008088d9601 in ?? () from /usr/local/lib/libOkular5Core.so.9 #2 0x0000000808bd1261 in ?? () from /usr/local/lib/libKF5JSApi.so.5 #3 0x0000000808c6e4cf in KJS::JSObject::get(KJS::ExecState*, KJS::Identifier const&) const () from /usr/local/lib/libKF5JS.so.5 #4 0x0000000808c89e16 in ?? () from /usr/local/lib/libKF5JS.so.5 #5 0x0000000808c3f200 in ?? () from /usr/local/lib/libKF5JS.so.5 #6 0x0000000808c734ff in KJS::Interpreter::evaluate(KJS::UString const&, int, KJS::UChar const*, int, KJS::JSValue*) () from /usr/local/lib/libKF5JS.so.5 #7 0x0000000808c73169 in KJS::Interpreter::evaluate(KJS::UString const&, int, KJS::UString const&, KJS::JSValue*) () from /usr/local/lib/libKF5JS.so.5 #8 0x0000000808bcf74d in KJSInterpreter::evaluate(QString const&, int, QString const&, KJSObject*) () from /usr/local/lib/libKF5JSApi.so.5 #9 0x00000008088cf06a in ?? () from /usr/local/lib/libOkular5Core.so.9 #10 0x0000000808895905 in ?? () from /usr/local/lib/libOkular5Core.so.9 #11 0x000000080886a14d in ?? () from /usr/local/lib/libOkular5Core.so.9 #12 0x0000000808873cb6 in Okular::Document::processValidateAction(Okular::Action const*, Okular::FormFieldText*, bool&) () from /usr/local/lib/libOkular5Core.so.9 #13 0x0000000802279fff in ?? () from /usr/local/lib/qt5/libQt5Core.so.5 #14 0x00000008086aca70 in ?? () from /usr/local/lib/qt5/plugins/okularpart.so #15 0x000000080871bcbd in ?? () from /usr/local/lib/qt5/plugins/okularpart.so #16 0x000000080129b9a0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #17 0x000000080129ce99 in QApplication::notify(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #18 0x0000000802242220 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Core.so.5 #19 0x00000008012991d6 in QApplicationPrivate::setFocusWidget(QWidget*, Qt::FocusReason) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #20 0x00000008012d1e82 in QWidget::setFocus(Qt::FocusReason) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #21 0x00000008012d24b4 in QWidget::focusNextPrevChild(bool) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #22 0x00000008012d734a in QWidget::event(QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #23 0x00000008013db9d0 in QLineEdit::event(QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #24 0x000000080871bdf8 in ?? () from /usr/local/lib/qt5/plugins/okularpart.so #25 0x000000080129b9a0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #26 0x000000080129cff6 in QApplication::notify(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #27 0x0000000802242220 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Core.so.5 #28 0x00000008012f3dde in ?? () from /usr/local/lib/qt5/libQt5Widgets.so.5 #29 0x000000080129b9a0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #30 0x000000080129ce99 in QApplication::notify(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #31 0x0000000802242220 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Core.so.5 #32 0x00000008018beab5 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/local/lib/qt5/libQt5Gui.so.5 #33 0x000000080815d68e in ?? () from /usr/local/lib/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so #34 0x0000000802279fff in ?? () from /usr/local/lib/qt5/libQt5Core.so.5 #35 0x0000000800ede07e in ?? () from /usr/local/lib/qt5/libQt5DBus.so.5 #36 0x000000080226ddcd in QObject::event(QEvent*) () from /usr/local/lib/qt5/libQt5Core.so.5 #37 0x000000080129b9a0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #38 0x000000080129ce99 in QApplication::notify(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Widgets.so.5 #39 0x0000000802242220 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/local/lib/qt5/libQt5Core.so.5 #40 0x00000008022432b9 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/local/lib/qt5/libQt5Core.so.5 #41 0x000000080229bec8 in ?? () from /usr/local/lib/qt5/libQt5Core.so.5 #42 0x0000000803821c8e in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.0 #43 0x0000000803822034 in ?? () from /usr/local/lib/libglib-2.0.so.0 #44 0x00000008038220f6 in g_main_context_iteration () from /usr/local/lib/libglib-2.0.so.0 #45 0x000000080229b900 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/local/lib/qt5/libQt5Core.so.5 #46 0x000000080223e467 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/local/lib/qt5/libQt5Core.so.5 --Type <RET> for more, q to quit, c to continue without paging--
In debugger it didn't crash from the first try like without debugger, but it crashed on the third try.
There's defenitely something fishy going on. valgrind says ==157594== Invalid read of size 8 ==157594== at 0xFBCE766: std::__shared_ptr<Okular::Event::Private, (__gnu_cxx::_Lock_policy)2>::get() const (shared_ptr_base.h:1325) ==157594== by 0xFBCE6AB: std::__shared_ptr_access<Okular::Event::Private, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const (shared_ptr_base.h:1024) ==157594== by 0xFBCE58D: std::__shared_ptr_access<Okular::Event::Private, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const (shared_ptr_base.h:1018) ==157594== by 0xFBCD493: Okular::Event::eventType() const (event.cpp:54) ==157594== by 0xFBF77EF: eventGetTarget(KJSContext*, void*) (kjs_event.cpp:75) ==157594== by 0xFDB89D3: ??? (in /usr/lib/libKF5JSApi.so.5.81.0) ==157594== by 0xFE39FFE: KJS::JSObject::get(KJS::ExecState*, KJS::Identifier const&) const (in /usr/lib/libKF5JS.so.5.81.0) ==157594== by 0xFE53014: ??? (in /usr/lib/libKF5JS.so.5.81.0) ==157594== by 0xFDFF401: ??? (in /usr/lib/libKF5JS.so.5.81.0) ==157594== by 0xFE3F3F2: ??? (in /usr/lib/libKF5JS.so.5.81.0) ==157594== by 0xFE3F5CC: KJS::Interpreter::evaluate(KJS::UString const&, int, KJS::UChar const*, int, KJS::JSValue*) (in /usr/lib/libKF5JS.so.5.81.0) ==157594== by 0xFE3F623: KJS::Interpreter::evaluate(KJS::UString const&, int, KJS::UString const&, KJS::JSValue*) (in /usr/lib/libKF5JS.so.5.81.0) ==157594== Address 0x23b48340 is 0 bytes inside a block of size 16 free'd ==157594== at 0x484008B: operator delete(void*, unsigned long) (vg_replace_malloc.c:593) ==157594== by 0xFBCEA46: std::_Sp_counted_ptr<Okular::Event*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() (shared_ptr_base.h:380) ==157594== by 0xFB72ADA: std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() (shared_ptr_base.h:158) ==157594== by 0xFB69DA0: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() (shared_ptr_base.h:733) ==157594== by 0xFB6863F: std::__shared_ptr<Okular::Event, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (shared_ptr_base.h:1183) ==157594== by 0xFB68671: std::shared_ptr<Okular::Event>::~shared_ptr() (shared_ptr.h:121) ==157594== by 0xFB5B1C3: Okular::Document::processValidateAction(Okular::Action const*, Okular::FormFieldText*, bool&) (document.cpp:4144) ==157594== by 0xF972060: PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}::operator()(Okular::Action const*, Okular::FormFieldText*, bool&) const (pageview.cpp:285) ==157594== by 0xF995A68: QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<Okular::Action const*, Okular::FormFieldText*, bool&>, void, PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}>::call({lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}&, void**) (qobjectdefs_impl.h:146) ==157594== by 0xF995635: void QtPrivate::Functor<PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}, 3>::call<QtPrivate::List<Okular::Action const*, Okular::FormFieldText*, bool&>, void>({lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}&, void*, {lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}&*) (qobjectdefs_impl.h:256) ==157594== by 0xF995203: QtPrivate::QFunctorSlotObject<PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}, 3, QtPrivate::List<Okular::Action const*, Okular::FormFieldText*, bool&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:443) ==157594== by 0x648D9E5: ??? (in /usr/lib/libQt5Core.so.5.15.2) ==157594== Block was alloc'd at ==157594== at 0x483EDEF: operator new(unsigned long) (vg_replace_malloc.c:342) ==157594== by 0xFBCE2FB: Okular::Event::createFormValidateEvent(Okular::FormField*, Okular::Page*, QString const&) (event.cpp:239) ==157594== by 0xFB5B16E: Okular::Document::processValidateAction(Okular::Action const*, Okular::FormFieldText*, bool&) (document.cpp:4144) ==157594== by 0xF972060: PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}::operator()(Okular::Action const*, Okular::FormFieldText*, bool&) const (pageview.cpp:285) ==157594== by 0xF995A68: QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<Okular::Action const*, Okular::FormFieldText*, bool&>, void, PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}>::call({lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}&, void**) (qobjectdefs_impl.h:146) ==157594== by 0xF995635: void QtPrivate::Functor<PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}, 3>::call<QtPrivate::List<Okular::Action const*, Okular::FormFieldText*, bool&>, void>({lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}&, void*, {lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}&*) (qobjectdefs_impl.h:256) ==157594== by 0xF995203: QtPrivate::QFunctorSlotObject<PageViewPrivate::formWidgetsController()::{lambda(Okular::Action const*, Okular::FormFieldText*, bool&)#4}, 3, QtPrivate::List<Okular::Action const*, Okular::FormFieldText*, bool&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:443) ==157594== by 0x648D9E5: ??? (in /usr/lib/libQt5Core.so.5.15.2) ==157594== by 0xF8932ED: FormWidgetsController::validateAction(Okular::Action const*, Okular::FormFieldText*, bool&) (moc_formwidgets.cpp:524) ==157594== by 0xF931CBA: FormLineEdit::event(QEvent*) (formwidgets.cpp:498) ==157594== by 0x5511761: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.15.2) ==157594== by 0x6456689: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.2)
Git commit 81344f8aa8244197f4292210c4f0b31d871a3d28 by Albert Astals Cid. Committed on 24/05/2021 at 17:53. Pushed by aacid into branch 'okular_focus_actions'. Unbox alert() parameters when they are in an object API let's you use both arguments or objects with named properties, so support both. This fixes the contents of the warning in 435833, the crash is still there though, working on that next M +54 -44 core/script/kjs_app.cpp https://invent.kde.org/graphics/okular/commit/81344f8aa8244197f4292210c4f0b31d871a3d28
Git commit e23d398d78c1747616e13f72e99887ef63cbc357 by Albert Astals Cid. Committed on 24/05/2021 at 22:24. Pushed by aacid into branch 'okular_focus_actions'. FormLineEdit: Don't run focusout/formatfield actions when losing focus because of window management Adobe Reader doesn't do it and if we do it can end up crashing because we end up running two focusout actions in parallel and our script system is not prepared for that: Scenario: * Tab out of a field * Script for that focusout runs * focus goes to next field * script for that focusout shows an alert() * second focusout script for that field runs while the first is running * bad stuff M +1 -1 part/formwidgets.cpp https://invent.kde.org/graphics/okular/commit/e23d398d78c1747616e13f72e99887ef63cbc357
I made a mistake and push it to the wrong branch, fix has still not landed
Git commit 81344f8aa8244197f4292210c4f0b31d871a3d28 by Albert Astals Cid. Committed on 24/05/2021 at 17:53. Pushed by aacid into branch 'release/21.04'. Unbox alert() parameters when they are in an object API let's you use both arguments or objects with named properties, so support both. This fixes the contents of the warning in 435833, the crash is still there though, working on that next M +54 -44 core/script/kjs_app.cpp https://invent.kde.org/graphics/okular/commit/81344f8aa8244197f4292210c4f0b31d871a3d28
Git commit b518c01f1c66a30ab2c32758c5267acecc96294a by Albert Astals Cid. Committed on 04/06/2021 at 21:17. Pushed by aacid into branch 'release/21.04'. FormLineEdit: Don't run focusout/formatfield actions when losing focus because of window management Adobe Reader doesn't do it and if we do it can end up crashing because we end up running two focusout actions in parallel and our script system is not prepared for that: Scenario: * Tab out of a field * Script for that focusout runs * focus goes to next field * script for that focusout shows an alert() * second focusout script for that field runs while the first is running * bad stuff M +1 -1 part/formwidgets.cpp https://invent.kde.org/graphics/okular/commit/b518c01f1c66a30ab2c32758c5267acecc96294a