Bug 352493 - Print Preview crashes, suspect uninitialised pointer
Summary: Print Preview crashes, suspect uninitialised pointer
Status: RESOLVED DUPLICATE of bug 348000
Alias: None
Product: okular
Classification: Applications
Component: printing (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-09 19:30 UTC by Jonathan Marten
Modified: 2015-09-09 19:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2015-09-09 19:30:06 UTC
When using the Print Preview function, either within Okular itself or another application, there is a crash with the following backtrace (irrelevant threads and bottom of stack trimmed):

Application: Okular (okular), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f6489a6e7c0 (LWP 18532))]
Thread 1 (Thread 0x7f6489a6e7c0 (LWP 18532)):
[KCrash Handler]
#6  data (this=0x8) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:135
#7  qGetPtrHelper<QScopedPointer<QObjectData> > (p=...) at ../../include/QtCore/../../src/corelib/global/qglobal.h:2580
#8  d_func (this=0x0) at kernel/qaction.h:67
#9  QAction::setEnabled (this=0x0, b=false) at kernel/qaction.cpp:1113
#10 0x00007f6479c79648 in PageView::slotRelayoutPages (this=0x26c55c0) at /ws/trunk/kdegraphics/okular/ui/pageview.cpp:4139
#11 0x00007f648777b126 in QObject::event (this=this@entry=0x26c55c0, e=e@entry=0x2718220) at kernel/qobject.cpp:1222
#12 0x00007f6486811deb in QWidget::event (this=this@entry=0x26c55c0, event=event@entry=0x2718220) at kernel/qwidget.cpp:8859
#13 0x00007f6486c1517e in QFrame::event (this=this@entry=0x26c55c0, e=e@entry=0x2718220) at widgets/qframe.cpp:557
#14 0x00007f6486ca069b in QAbstractScrollArea::event (this=0x26c55c0, e=0x2718220) at widgets/qabstractscrollarea.cpp:996
#15 0x00007f64867b2431 in QApplicationPrivate::notify_helper (this=this@entry=0x1364b70, receiver=receiver@entry=0x26c55c0, e=e@entry=0x2718220) at kernel/qapplication.cpp:4565
#16 0x00007f64867b93f5 in QApplication::notify (this=this@entry=0x7fffbb6bedd0, receiver=receiver@entry=0x26c55c0, e=e@entry=0x2718220) at kernel/qapplication.cpp:4351
#17 0x00007f6488700296 in KApplication::notify (this=0x7fffbb6bedd0, receiver=0x26c55c0, event=0x2718220) at /ws/trunk/kdelibs/kdeui/kernel/kapplication.cpp:311
#18 0x00007f648776056c in QCoreApplication::notifyInternal (this=0x7fffbb6bedd0, receiver=receiver@entry=0x26c55c0, event=event@entry=0x2718220) at kernel/qcoreapplication.cpp:955
#19 0x00007f6487763bf0 in sendEvent (event=0x2718220, receiver=0x26c55c0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#20 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, receiver@entry=0x7f6487791a80 <postEventSourceDispatch(GSource*, GSourceFunc, gpointer)>, event_type=event_type@entry=0, data=0x1342a20) at kernel/qcoreapplication.cpp:1579
#21 0x00007f6487764027 in QCoreApplication::sendPostedEvents (receiver=0x7f6487791a80 <postEventSourceDispatch(GSource*, GSourceFunc, gpointer)>, receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1472

Note: the actual Okular version (not available here in bugs.kde.org) is
Qt: 4.8.7
KDE Development Platform: 4.14.6
Okular: 0.22.60


Reproducible: Always

Steps to Reproduce:
1.  Run Okular to display a simple PDF file.
2.  Select File - Print Preview from the menu.




What seems to be happening is that the Okular::Part::Part() constructor (in part.cpp) correctly detects that it is in print preview mode via detectEmbedMode().  Then, near the end, it does:

    m_pageView->setupBaseActions( actionCollection() );
    m_sidebar->setSidebarVisibility( false );
    if ( m_embedMode != PrintPreviewMode )
    {
        // now set up actions that are required for all remaining modes
        m_pageView->setupViewerActions( actionCollection() );
        // and if we are not in viewer mode, we want the full GUI
        if ( m_embedMode != ViewerWidgetMode )
        {
            unsetDummyMode();
        }
    }

The problem is in ui/pageview.cpp where d->aFitWindowToPage is only initialised in PageView::setupViewerActions(), but it can be used in PageView::slotRelayoutPages() or PageView::updateActionState().  In print preview mode setupViewerActions() is never called and so a null or uninitialised pointer will be used.
Comment 1 Jonathan Marten 2015-09-09 19:37:37 UTC
Sorry, just noticed that this is a duplicate.  Strange that a bko search neither on 'okular' nor 'print preview' failed to turn up that bug...

*** This bug has been marked as a duplicate of bug 348000 ***