Bug 417118

Summary: Okular crashes on Print preview
Product: [Applications] okular Reporter: Siddhartha <kde>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: crash CC: aacid, david.hurka, yurchor
Priority: NOR Keywords: drkonqi
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Siddhartha 2020-02-03 20:42:53 UTC
Application: okular (1.9.70)
 (Compiled from sources)
Qt Version: 5.14.1
Frameworks Version: 5.67.0
Operating System: Linux 5.5.1-arch1-1 x86_64
Windowing system: X11
Distribution: Arch Linux

-- Information about the crash:
OPening File -> Print Preview on any pdf file (tried on 3 different ones) crashes Okular.

The crash can be reproduced every time.

-- Backtrace:
Application: Okular (okular), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fd296a50600 (LWP 59660))]

Thread 7 (Thread 0x7fd28632f700 (LWP 59666)):
#0  0x00007fd299a94c45 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007fd287828dec in ?? () from /usr/lib/dri/i965_dri.so
#2  0x00007fd2878289e8 in ?? () from /usr/lib/dri/i965_dri.so
#3  0x00007fd299a8e4cf in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007fd29a5122d3 in clone () from /usr/lib/libc.so.6

Thread 6 (Thread 0x7fd286b30700 (LWP 59665)):
#0  0x00007fd299a94c45 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007fd287828dec in ?? () from /usr/lib/dri/i965_dri.so
#2  0x00007fd2878289e8 in ?? () from /usr/lib/dri/i965_dri.so
#3  0x00007fd299a8e4cf in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007fd29a5122d3 in clone () from /usr/lib/libc.so.6

Thread 5 (Thread 0x7fd27eb30700 (LWP 59664)):
#0  0x00007fd299a94c45 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007fd287828dec in ?? () from /usr/lib/dri/i965_dri.so
#2  0x00007fd2878289e8 in ?? () from /usr/lib/dri/i965_dri.so
#3  0x00007fd299a8e4cf in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007fd29a5122d3 in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7fd287331700 (LWP 59663)):
#0  0x00007fd299a94c45 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007fd287828dec in ?? () from /usr/lib/dri/i965_dri.so
#2  0x00007fd2878289e8 in ?? () from /usr/lib/dri/i965_dri.so
#3  0x00007fd299a8e4cf in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007fd29a5122d3 in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7fd28fdd3700 (LWP 59662)):
#0  0x00007fd29a5079ef in poll () from /usr/lib/libc.so.6
#1  0x00007fd298f63120 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007fd298f631f1 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007fd29aac403c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#4  0x00007fd29aa6a4cc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007fd29a88ee52 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#6  0x00007fd29ad14b28 in ?? () from /usr/lib/libQt5DBus.so.5
#7  0x00007fd29a88ffc6 in ?? () from /usr/lib/libQt5Core.so.5
#8  0x00007fd299a8e4cf in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007fd29a5122d3 in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7fd295c67700 (LWP 59661)):
#0  0x00007fd29a5079ef in poll () from /usr/lib/libc.so.6
#1  0x00007fd299d0e630 in ?? () from /usr/lib/libxcb.so.1
#2  0x00007fd299d102db in xcb_wait_for_event () from /usr/lib/libxcb.so.1
#3  0x00007fd296634b81 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#4  0x00007fd29a88ffc6 in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007fd299a8e4cf in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007fd29a5122d3 in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7fd296a50600 (LWP 59660)):
[KCrash Handler]
#6  0x00007fd29b59a6a5 in QAction::setEnabled(bool) () from /usr/lib/libQt5Widgets.so.5
#7  0x00007fd28eb1261f in PageView::updateActionState (this=0x55f58f3d05c0, haspages=haspages@entry=false, documentChanged=documentChanged@entry=false, hasformwidgets=hasformwidgets@entry=false) at /usr/src/debug/okular/ui/pageview.cpp:1268
#8  0x00007fd28eaa6e18 in Okular::Part::Part (this=this@entry=0x55f58f38abb0, parentWidget=parentWidget@entry=0x7fffe4dade50, parent=parent@entry=0x7fffe4dade50, args=..., __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /usr/include/c++/9.2.0/bits/atomic_base.h:413
#9  0x00007fd28eab00d4 in KPluginFactory::createPartInstance<Okular::Part> (parentWidget=0x7fffe4dade50, parent=0x7fffe4dade50, args=...) at /usr/include/KF5/KCoreAddons/kpluginfactory.h:536
#10 0x00007fd29bb308a5 in KPluginFactory::create (this=0x55f58ebb0dc0, iface=0x7fd29c295a18 <qt_meta_stringdata_KParts__ReadOnlyPart+408> "KParts::ReadOnlyPart", parentWidget=0x7fffe4dade50, parent=0x7fffe4dade50, args=..., keyword=...) at /usr/src/debug/kcoreaddons/src/lib/plugin/kpluginfactory.cpp:145
#11 0x00007fd28ead58db in KPluginFactory::create<KParts::ReadOnlyPart> (args=..., parent=0x7fffe4dade50, this=0x55f58ebb0dc0) at /usr/include/qt/QtCore/qobject.h:153
#12 Okular::FilePrinterPreviewPrivate::getPart (this=0x55f58f5b3760) at /usr/src/debug/okular/ui/fileprinterpreview.cpp:108
#13 Okular::FilePrinterPreviewPrivate::getPart (this=0x55f58f5b3760) at /usr/src/debug/okular/ui/fileprinterpreview.cpp:75
#14 0x00007fd28ead5fcc in Okular::FilePrinterPreviewPrivate::doPreview (this=0x55f58f5b3760) at /usr/src/debug/okular/ui/fileprinterpreview.cpp:122
#15 0x00007fd28ead66ec in Okular::FilePrinterPreview::showEvent (this=0x7fffe4dade50, event=0x7fffe4dadc40) at /usr/src/debug/okular/ui/fileprinterpreview.cpp:177
#16 0x00007fd29b5e24de in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#17 0x00007fd29b59e362 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#18 0x00007fd29b5a7819 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#19 0x00007fd29aa6b962 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#20 0x00007fd29b5ded38 in QWidgetPrivate::show_helper() () from /usr/lib/libQt5Widgets.so.5
#21 0x00007fd29b5e1fad in QWidgetPrivate::setVisible(bool) () from /usr/lib/libQt5Widgets.so.5
#22 0x00007fd29b7acec8 in QDialog::setVisible(bool) () from /usr/lib/libQt5Widgets.so.5
#23 0x00007fd29b7ac4f9 in QDialog::exec() () from /usr/lib/libQt5Widgets.so.5
#24 0x00007fd28eaae16f in Okular::Part::slotPrintPreview (this=<optimized out>) at /usr/src/debug/okular/part.cpp:3042
#25 0x00007fd28ea6e342 in Okular::Part::qt_static_metacall (_o=0x55f58ebaf450, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/src/debug/build/okularpart_autogen/EWIEGA46WW/moc_part.cpp:449
#26 0x00007fd29aaa14a0 in ?? () from /usr/lib/libQt5Core.so.5
#27 0x00007fd29b597f33 in QAction::triggered(bool) () from /usr/lib/libQt5Widgets.so.5
#28 0x00007fd29b59a61c in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQt5Widgets.so.5
#29 0x00007fd29aa9926a in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#30 0x00007fd29b59af24 in QAction::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#31 0x00007fd29b59e362 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#32 0x00007fd29b5a7819 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#33 0x00007fd29aa6b962 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#34 0x00007fd29aa6e1c6 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5
#35 0x00007fd29aac49d4 in ?? () from /usr/lib/libQt5Core.so.5
#36 0x00007fd298f6139e in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#37 0x00007fd298f631b1 in ?? () from /usr/lib/libglib-2.0.so.0
#38 0x00007fd298f631f1 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#39 0x00007fd29aac4020 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#40 0x00007fd29aa6a4cc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#41 0x00007fd29aa724d6 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#42 0x000055f58cfbb79a in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/okular/shell/main.cpp:95
[Inferior 1 (process 59660) detached]

Possible duplicates by query: bug 390383, bug 355172, bug 348000, bug 346671, bug 264667.

Reported using DrKonqi
Comment 1 Albert Astals Cid 2020-02-03 22:55:19 UTC
How recent is your "compiled from sources"?
Comment 2 Siddhartha 2020-02-03 22:58:49 UTC
Built from the latest master (commit on Feb 1): okular-git-r8658.c6d937ab0
Comment 3 Albert Astals Cid 2020-02-04 23:08:26 UTC
Garg, i shouldn't have merged the code from David from phabricaotr without using invent.

The unittests would have found it.

David can you please fix this mess?
Comment 4 Albert Astals Cid 2020-02-04 23:09:34 UTC
Yuri i guess this is the same thing you're seeing in Kile
Comment 5 Yuri Chornoivan 2020-02-05 07:29:45 UTC
(In reply to Albert Astals Cid from comment #4)
> Yuri i guess this is the same thing you're seeing in Kile

Yes, both problems can be removed after reverting 0d5bd0bc43b26e94833b133afc2fbbdb66346652
Comment 6 David Hurka 2020-02-05 13:43:30 UTC
I think it is a problem because Print Preview opens a new window with another ToggleActionMenu? I will try to investigate, maybe tomorrow.

Maybe it is a good Idea to drop ToggleActionMenu. ...
Comment 7 David Hurka 2020-02-07 15:23:50 UTC
To fix this, just d->aMouseModeMenu needs to be nullptr-initialized in the PageView constructor. Apparently I forgot that when I created D21971.

How can I create a merge request? On the invent.kde.org website, I am apparently not allowed to do so. Via the git command line, I get an error that I am not allowed to do so. And via email, I get a reply that I am not allowed to do so...
Comment 8 Yuri Chornoivan 2020-02-07 15:43:34 UTC
(In reply to David Hurka from comment #7)
> To fix this, just d->aMouseModeMenu needs to be nullptr-initialized in the
> PageView constructor. Apparently I forgot that when I created D21971.
> 
> How can I create a merge request? On the invent.kde.org website, I am
> apparently not allowed to do so. Via the git command line, I get an error
> that I am not allowed to do so. And via email, I get a reply that I am not
> allowed to do so...

Can you fork the repo? If so, just commit into your clone then create merge request.
Comment 9 Albert Astals Cid 2020-02-10 00:30:12 UTC
Git commit cb3426d024971f6de424fbeed1b94869222eb10f by Albert Astals Cid.
Committed on 09/02/2020 at 23:42.
Pushed by aacid into branch 'master'.

Fix crash when not in viewer mode

M  +1    -0    ui/pageview.cpp

https://invent.kde.org/kde/okular/commit/cb3426d024971f6de424fbeed1b94869222eb10f