[Okular-devel] [okular] [Bug 352493] New: Print Preview crashes, suspect uninitialised pointer

Jonathan Marten jjm at keelhaul.me.uk
Wed Sep 9 19:30:06 UTC 2015


https://bugs.kde.org/show_bug.cgi?id=352493

            Bug ID: 352493
           Summary: Print Preview crashes, suspect uninitialised pointer
           Product: okular
           Version: unspecified
          Platform: Compiled Sources
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: printing
          Assignee: okular-devel at kde.org
          Reporter: jjm at keelhaul.me.uk

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 at entry=0x26c55c0,
e=e at entry=0x2718220) at kernel/qobject.cpp:1222
#12 0x00007f6486811deb in QWidget::event (this=this at entry=0x26c55c0,
event=event at entry=0x2718220) at kernel/qwidget.cpp:8859
#13 0x00007f6486c1517e in QFrame::event (this=this at entry=0x26c55c0,
e=e at 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 at entry=0x1364b70, receiver=receiver at entry=0x26c55c0,
e=e at entry=0x2718220) at kernel/qapplication.cpp:4565
#16 0x00007f64867b93f5 in QApplication::notify (this=this at entry=0x7fffbb6bedd0,
receiver=receiver at entry=0x26c55c0, e=e at 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 at entry=0x26c55c0,
event=event at 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 at entry=0x7f6487791a80 <postEventSourceDispatch(GSource*, GSourceFunc,
gpointer)>, event_type=event_type at entry=0, data=0x1342a20) at
kernel/qcoreapplication.cpp:1579
#21 0x00007f6487764027 in QCoreApplication::sendPostedEvents
(receiver=0x7f6487791a80 <postEventSourceDispatch(GSource*, GSourceFunc,
gpointer)>, receiver at entry=0x0, event_type=event_type at 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.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list