[okular] [Bug 415340] Crash when closing print preview dialog on Linux
jimbo1qaz
bugzilla_noreply at kde.org
Thu Dec 19 05:54:48 GMT 2019
https://bugs.kde.org/show_bug.cgi?id=415340
--- Comment #2 from jimbo1qaz <jimbo1qaz at protonmail.com> ---
The crash occurs after ~FilePrinterPreview finishes, while unwinding
FilePrinterPreview's Qt child widgets (via QObjectPrivate::deleteChildren).
Okular::Part::~Part calls Okular::Document::closeDocument calls
d->saveDocumentInfo().
void DocumentPrivate::saveDocumentInfo() const
{
...
for ( View *view : qAsConst(m_views) )
{
QDomElement viewEntry = doc.createElement( QStringLiteral("view") );
viewEntry.setAttribute( QStringLiteral("name"), view->name() );
viewsNode.appendChild( viewEntry );
saveViewsInfo( view, viewEntry );
}
void DocumentPrivate::saveViewsInfo( View *view, QDomElement &e ) const
{
...
const bool mode = view->capability( View::Continuous ).toBool();
QVariant PageView::capability( ViewCapability capability ) const
{
switch ( capability )
{
...
case Continuous:
return d->aViewContinuous->isChecked();
## Null pointers
The problem is that PageView::d's member pointers are mostly nullptr (assigned
by the constructor). This is what causes the crash.
Is the PageViewPrivate of a print preview document supposed to contain many
nullptr, or should the pointers be initialized through
PageView::setupViewerActions()? (This method constructs QAction and whatnot.
Maybe it makes no sense to initialize them to QAction/etc, since the print
preview dialog has no buttons.)
## Operating on null pointers.
I'm suspicious that Okular::Document::closeDocument unconditionally calls
DocumentPrivate::saveDocumentInfo() (which leads to the crash). Is it necessary
to save the info of a print-preview document? (It crashes if
PageView::setupViewerActions() has not been called.)
The hacky workaround is to patch PageView::capability() to return some dummy
value instead of dereferencing null pointers.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Okular-devel
mailing list