Fix bug #378513: akregator crash on session restore
AbandonedPublic

Authored by mtijink on Aug 1 2017, 9:11 PM.

Details

Reviewers
None
Group Reviewers
KDE PIM
Summary

I think this fixes bug #378513. The bug occurred (during session restore) when the code tries to cast to a WebFrameEngine, but since the main frame has already been deleted, this fails.

Using this code, the MainWidget removes the main frame from the frame manager before it's deleted. I'm not sure this fully fixes the original problem, but I do not have crashes anymore with this diff. Note: I only tested it on the Applications/17.4 branch, since master required compiling lots of packages, so you may want to test it on master first.

Test Plan

No crashes anymore for me. I could replicate the original bug by trying to restore from a session.

Diff Detail

Repository
R201 Akregator
Branch
fix_bug_378513
Lint
No Linters Available
Unit
No Unit Test Coverage
mtijink created this revision.Aug 1 2017, 9:11 PM
mtijink added a subscriber: KDE PIM.

Sorry, seems I did not test thorougly enough: akregator does not crash on startup anymore, but crashes elsewhere later on. When I click on a feed, I get the following backtrace:

#0  0x00007f1b49ced358 in KActionCollection::action(QString const&) const ()
   from /usr/lib/libKF5XmlGui.so.5
#1  0x00007f1b11006678 in Akregator::ActionManagerImpl::action (
    this=0x10073b320, name=...)
    at /home/matthijs/kde/kdesrc/kde/pim/akregator/src/actions/actionmanagerimpl.cpp:639
#2  0x00007f1b11006a22 in Akregator::ActionManagerImpl::setArticleActionsEnabled (this=0x10073b320, enabled=false)
    at /home/matthijs/kde/kdesrc/kde/pim/akregator/src/actions/actionmanagerimpl.cpp:646
#3  0x00007f1b4a9d3b01 in Akregator::ArticleViewerWidget::setArticleActionsEnabled (this=0x100773870, enabled=false)
    at /home/matthijs/kde/kdesrc/kde/pim/akregator/src/articleviewerwidget.cpp:417
#4  0x00007f1b4a9d2705 in Akregator::ArticleViewerWidget::slotShowSummary (
    this=0x100773870, node=0x100c0de50)
    at /home/matthijs/kde/kdesrc/kde/pim/akregator/src/articleviewerwidget.cpp:194
#5  0x00007f1b11030e46 in Akregator::MainWidget::slotNodeSelected (
    this=0x100779cc0, node=0x100c0de50)
    at /home/matthijs/kde/kdesrc/kde/pim/akregator/src/mainwidget.cpp:696
#6  0x00007f1b11039da9 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<Akregator::TreeNode*>, void, void (Akregator::MainWidget::*)(Akregator::TreeNode*)>::call (f=
    (void (Akregator::MainWidget::*)(Akregator::MainWidget * const, Akregator::TreeNode *)) 0x7f1b11030d04 <Akregator::MainWidget::slotNodeSelected(Akregator::TreeNode*)>, o=0x100779cc0, arg=0x7fffffffc6d0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:136
#7  0x00007f1b110394e3 in QtPrivate::FunctionPointer<void (Akregator::MainWidget::*)(Akregator::TreeNode*)>::call<QtPrivate::List<Akregator::TreeNode*>, void>
    (f=
    (void (Akregator::MainWidget::*)(Akregator::MainWidget * const, Akregator::TreeNode *)) 0x7f1b11030d04 <Akregator::MainWidget::slotNodeSelected(Akregator::TreeNode*)>, o=0x100779cc0, arg=0x7fffffffc6d0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:169
#8  0x00007f1b11038545 in QtPrivate::QSlotObject<void (Akregator::MainWidget::*)(Akregator::TreeNode*), QtPrivate::List<Akregator::TreeNode*>, void>::impl (
    which=1, this_=0x1007df310, r=0x100779cc0, a=0x7fffffffc6d0, ret=0x0)
    at /usr/include/qt/QtCore/qobject_impl.h:120
#9  0x00007f1b45a0f8af in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/libQt5Core.so.5
#10 0x00007f1b110421de in Akregator::AbstractSelectionController::currentSubscriptionChanged (this=0x1007a34d0, _t1=0x100c0de50)
    at /home/matthijs/kde/kdesrc/build/kde/pim/akregator/src/akregatorpart_autogen/EWIEGA46WW/moc_abstractselectioncontroller.cpp:173
#11 0x00007f1b10ff504e in Akregator::SelectionController::selectedSubscriptionChanged (this=0x1007a34d0, index=...)
    at /home/matthijs/kde/kdesrc/kde/pim/akregator/src/selectioncontroller.cpp:257
#12 0x00007f1b10ff7533 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QModelIndex const&>, void, void (Akregator::SelectionController::*)(QModelIndex const&)>::call (f=
    (void (Akregator::SelectionController::*)(Akregator::SelectionController * const, const QModelIndex &)) 0x7f1b10ff4f4a <Akregator::SelectionController::selectedSubscriptionChanged(QModelIndex const&)>, o=0x1007a34d0, 
    arg=0x7fffffffc940) at /usr/include/qt/QtCore/qobjectdefs_impl.h:136
#13 0x00007f1b10ff71af in QtPrivate::FunctionPointer<void (Akregator::SelectionController::*)(QModelIndex const&)>::call<QtPrivate::List<QModelIndex const&>, void> (f=
    (void (Akregator::SelectionController::*)(Akregator::SelectionController * const, const QModelIndex &)) 0x7f1b10ff4f4a <Akregator::SelectionController::selectedSubscriptionChanged(QModelIndex const&)>, o=0x1007a34d0, 
    arg=0x7fffffffc940) at /usr/include/qt/QtCore/qobjectdefs_impl.h:169
#14 0x00007f1b10ff6bfd in QtPrivate::QSlotObject<void (Akregator::SelectionController::*)(QModelIndex const&), QtPrivate::List<QModelIndex const&>, void>::impl
    (which=1, this_=0x101867300, r=0x1007a34d0, a=0x7fffffffc940, ret=0x0)
    at /usr/include/qt/QtCore/qobject_impl.h:120
#15 0x00007f1b45a0f8af in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/libQt5Core.so.5
#16 0x00007f1b4598b0bb in QItemSelectionModel::currentChanged(QModelIndex const&, QModelIndex const&) () from /usr/lib/libQt5Core.so.5
#17 0x00007f1b4598b3b5 in QItemSelectionModel::setCurrentIndex(QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) () from /usr/lib/libQt5Core.so.5
#18 0x00007f1b469602ee in QAbstractItemView::mousePressEvent(QMouseEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#19 0x00007f1b469a487c in QTreeView::mousePressEvent(QMouseEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#20 0x00007f1b467496ef in QWidget::event(QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#21 0x00007f1b4682c60f in QFrame::event(QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#22 0x00007f1b469654a4 in QAbstractItemView::viewportEvent(QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#23 0x00007f1b469a42bd in QTreeView::viewportEvent(QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#24 0x00007f1b459df89c in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#25 0x00007f1b46706e28 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /usr/lib/libQt5Widgets.so.5
#26 0x00007f1b4670eea1 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#27 0x00007f1b459dfbd0 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    () from /usr/lib/libQt5Core.so.5
#28 0x00007f1b4670de2a in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/libQt5Widgets.so.5
#29 0x00007f1b46763f51 in ?? () from /usr/lib/libQt5Widgets.so.5
#30 0x00007f1b46766691 in ?? () from /usr/lib/libQt5Widgets.so.5
#31 0x00007f1b46706e4c in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /usr/lib/libQt5Widgets.so.5
#32 0x00007f1b4670e926 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libQt5Widgets.so.5
#33 0x00007f1b459dfbd0 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    () from /usr/lib/libQt5Core.so.5
#34 0x00007f1b45f421e4 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#35 0x00007f1b45f43d46 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#36 0x00007f1b45f1b4ac in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#37 0x00007f1b1d7cacc1 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#38 0x00007f1b34572a57 in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#39 0x00007f1b34572c88 in ?? () from /usr/lib/libglib-2.0.so.0
#40 0x00007f1b34572d1c in g_main_context_iteration ()
   from /usr/lib/libglib-2.0.so.0
#41 0x00007f1b45a3a061 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#42 0x00007f1b459ddffb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#43 0x00007f1b459e7048 in QCoreApplication::exec() ()
   from /usr/lib/libQt5Core.so.5
#44 0x0000000100009e52 in main (argc=1, argv=0x7fffffffdac8)
    at /home/matthijs/kde/kdesrc/kde/pim/akregator/src/main.cpp:124

I'm not exactly an expert on akregator code, so maybe someone here can help me figure this out?

https://phabricator.kde.org/D6739 In restore session central widget got deleted which trigger part to delete itself.

src/mainwidget.cpp
348–349

Rather than add new slot does it better to use

Kernel::self()->frameManager()->slotRemoveFrame(m_mainFrame->id());
mtijink abandoned this revision.Aug 18 2017, 6:51 PM