Bug 390964 - Crash when clicking [Settings -> Configure Chat Application...] version 17.12.2
Summary: Crash when clicking [Settings -> Configure Chat Application...] version 17.12.2
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Frameworks and Libraries
Component: text-ui (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-23 18:52 UTC by CapSel
Modified: 2019-08-12 22:05 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
0001-app-Fix-crash-while-displaying-Settings-dialog.patch (1.71 KB, patch)
2018-03-01 20:17 UTC, David Strobach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description CapSel 2018-02-23 18:52:12 UTC
Crashes every time.

Some debugging I've done:
Thread 1 "ktp-text-ui" received signal SIGSEGV, Segmentation fault.
0x00007ffff7da4dbc in KCModuleProxy::d_func (this=0x0) at /var/tmp/portage/kde-frameworks/kcmutils-5.43.0/work/kcmutils-5.43.0/src/kcmoduleproxy.h:68
68          Q_DECLARE_PRIVATE(KCModuleProxy)
(gdb) list
63       * @author Matthias Kretz <kretz@kde.org>
64       *
65       */
66      class KCMUTILS_EXPORT KCModuleProxy : public QWidget
67      {
68          Q_DECLARE_PRIVATE(KCModuleProxy)
69          Q_OBJECT
70      public:
71          /**
72           * Constructs a KCModuleProxy from a KCModuleInfo class.
(gdb) up
#1  0x00007ffff7da31d1 in KCModuleProxy::realModule (this=0x0) at /var/tmp/portage/kde-frameworks/kcmutils-5.43.0/work/kcmutils-5.43.0/src/kcmoduleproxy.cpp:66
66          Q_D(const KCModuleProxy);
(gdb) up
#2  0x000055555557862d in ChatWindow::showSettingsDialog (this=0x5555559510d0) at /var/tmp/portage/kde-apps/ktp-text-ui-17.12.2/work/ktp-text-ui-17.12.2/app/chat-window.cpp:766
766         connect(proxy->realModule(), SIGNAL(reloadTheme()),
(gdb) p proxy
$1 = (KCModuleProxy *) 0x0
(gdb) list
761     
762         KPageWidgetItem *configPage = dialog->addModule(QLatin1String("kcm_ktp_chat_appearance"));
763         KCModuleProxy *proxy = qobject_cast<KCModuleProxy*>(configPage->widget());
764         Q_ASSERT(proxy);
765     
766         connect(proxy->realModule(), SIGNAL(reloadTheme()),
767                 this, SLOT(onReloadTheme()));
768     
769         dialog->addModule(QLatin1String("kcm_ktp_chat_behavior"));
770         dialog->addModule(QLatin1String("kcm_ktp_chat_messages"));
(gdb) p configPage
$2 = (KPageWidgetItem *) 0x555557dfb300
(gdb) p this
$3 = (ChatWindow * const) 0x5555559510d0

Stack trace:
(gdb) bt
#0  0x00007ffff7da4dbc in KCModuleProxy::d_func (this=0x0) at /var/tmp/portage/kde-frameworks/kcmutils-5.43.0/work/kcmutils-5.43.0/src/kcmoduleproxy.h:68
#1  0x00007ffff7da31d1 in KCModuleProxy::realModule (this=0x0) at /var/tmp/portage/kde-frameworks/kcmutils-5.43.0/work/kcmutils-5.43.0/src/kcmoduleproxy.cpp:66
#2  0x000055555557862d in ChatWindow::showSettingsDialog (this=0x5555559510d0) at /var/tmp/portage/kde-apps/ktp-text-ui-17.12.2/work/ktp-text-ui-17.12.2/app/chat-window.cpp:766
#3  0x0000555555589f62 in ChatWindow::qt_static_metacall (_o=0x5555559510d0, _c=QMetaObject::InvokeMetaMethod, _id=47, _a=0x7fffffffc270)
    at /var/tmp/portage/kde-apps/ktp-text-ui-17.12.2/work/ktp-text-ui-17.12.2_build/app/ktp-text-ui_autogen/EWIEGA46WW/moc_chat-window.cpp:321
#4  0x00007ffff64e7173 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#5  0x00007ffff6d25762 in QAction::triggered(bool) () from /usr/lib64/libQt5Widgets.so.5
#6  0x00007ffff6d27e4c in QAction::activate(QAction::ActionEvent) () from /usr/lib64/libQt5Widgets.so.5
#7  0x00007ffff6ea4a7c in ?? () from /usr/lib64/libQt5Widgets.so.5
#8  0x00007ffff6eabf2b in ?? () from /usr/lib64/libQt5Widgets.so.5
#9  0x00007ffff6eacd3f in QMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libQt5Widgets.so.5
#10 0x00007ffff6d6a6f8 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#11 0x00007ffff6eaf08b in QMenu::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#12 0x00007ffff6d2be1c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#13 0x00007ffff6d33c2f in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#14 0x00007ffff64be517 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#15 0x00007ffff6d32c02 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQt5Widgets.so.5
#16 0x00007ffff6d85415 in ?? () from /usr/lib64/libQt5Widgets.so.5
#17 0x00007ffff6d87cea in ?? () from /usr/lib64/libQt5Widgets.so.5
#18 0x00007ffff6d2be1c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#19 0x00007ffff6d336d4 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#20 0x00007ffff64be517 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#21 0x00007ffff680fa7b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib64/libQt5Gui.so.5
#22 0x00007ffff6811665 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib64/libQt5Gui.so.5
#23 0x00007ffff67eb08b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Gui.so.5
#24 0x00007fffe6a44430 in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#25 0x00007ffff3b54ab7 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#26 0x00007ffff3b54ce8 in ?? () from /usr/lib64/libglib-2.0.so.0
#27 0x00007ffff3b54d7c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#28 0x00007ffff650fc3f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#29 0x00007ffff64bd29a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#30 0x00007ffff64c5a14 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#31 0x0000555555567044 in main (argc=1, argv=0x7fffffffd1e8) at /var/tmp/portage/kde-apps/ktp-text-ui-17.12.2/work/ktp-text-ui-17.12.2/app/main.cpp:72
Comment 1 Max Sydorenko 2018-02-24 14:22:51 UTC
Confirm this bug on Arch Linux, on fresh built from git master.
Crashes every time.
Comment 2 David Strobach 2018-03-01 20:17:58 UTC
Created attachment 111119 [details]
0001-app-Fix-crash-while-displaying-Settings-dialog.patch

The crash is due to the fact that the KPageWidgetItem does no longer hold a reference to KCModuleProxy instance. The KCModuleProxy instance is rather wrapped in a QScrollArea instance.
Tentative patch attached.
Comment 3 David Strobach 2018-03-01 21:48:19 UTC
@CapSel: Could you please check whether the attached patch fixes the bug for you? If it does, I'll post it to Phabricator for review, commit it and close the bug eventually. Thanks.
Comment 4 CapSel 2018-03-01 22:55:38 UTC
Your patch works. Thank You!
Comment 5 Eugene Shalygin 2018-03-28 12:58:53 UTC
(In reply to David Strobach from comment #3)
Thanks for the patch! Could you, please, look into ktp-log-viewer too? It crashes in the very same way.
Comment 6 Christoph Feck 2018-04-26 22:47:39 UTC
Thanks for the fix, David. Was the patch already added to Phabricator?
Comment 7 David Strobach 2018-04-30 12:36:15 UTC
> Thanks for the fix, David. Was the patch already added to Phabricator?
Hi Christoph, no, unfortunately not yet. I somehow can't digest the idea, that the change my patch does is the right(TM) way to integrate KCMs after the recent KCM refactoring. I would like to first check other KDE projects to see how they made their way through the KCM refactoring before submitting the fix. I expect to be able to move ahead during this week.
Comment 8 David Strobach 2018-07-13 22:35:12 UTC
Fixed by commits
d55f70722af76015dd79b278618fdbf9972c29ff
0862d220c9042baa25200b0e178cc9ce44525a13
Comment 9 danjaredg 2019-08-12 22:05:08 UTC
I use KdeNEON and it is frustrating that this package is not updated, to avoid this error, along with the text-ui viewer, I run the following script.


apt install pidgin-sipe kde-telepathy

# (you need activate "dep-src" en /etc/apt/source.list)

mkdir ktp-text-ui-fix
cd ktp-text-ui-fix
    apt install build-essential devscripts
    apt source kde-telepathy-text-ui
    apt build-dep kde-telepathy-text-ui
    cd ktp-text-ui-*
    patch -p1 << "EOF"
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -68,6 +68,8 @@ bool AdiumThemePage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Na
         Q_EMIT nextConversation();
     } else if (url.fragment() == QLatin1String("x-prevConversation")) {
         Q_EMIT prevConversation();
+    } else if (url.scheme() == QLatin1String("data")) {
+        return true;
     } else {
         QDesktopServices::openUrl(url);
     }
EOF
patch -p1 << "EOF"
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -53,6 +53,7 @@
 #include <QLabel>
 #include <QLineEdit>
 #include <QMouseEvent>
+#include <QScrollArea>
 
 #include <TelepathyQt/Account>
 #include <TelepathyQt/ContactCapabilities>
@@ -760,7 +761,9 @@ void ChatWindow::showSettingsDialog()
     KSettings::Dialog *dialog = new KSettings::Dialog(this);
 
     KPageWidgetItem *configPage = dialog->addModule(QLatin1String("kcm_ktp_chat_appearance"));
-    KCModuleProxy *proxy = qobject_cast<KCModuleProxy*>(configPage->widget());
+    QScrollArea *moduleScroll = qobject_cast<QScrollArea*>(configPage->widget());
+    Q_ASSERT(moduleScroll);
+    KCModuleProxy *proxy = qobject_cast<KCModuleProxy*>(moduleScroll->widget());
     Q_ASSERT(proxy);
 
     connect(proxy->realModule(), SIGNAL(reloadTheme()),
@@ -770,7 +773,9 @@ void ChatWindow::showSettingsDialog()
     dialog->addModule(QLatin1String("kcm_ktp_chat_messages"));
 
     KPageWidgetItem *otrConfigPage = dialog->addModule(QLatin1String("kcm_ktp_chat_otr"));
-    proxy = qobject_cast<KCModuleProxy*>(otrConfigPage->widget());
+    moduleScroll = qobject_cast<QScrollArea*>(otrConfigPage->widget());
+    Q_ASSERT(moduleScroll);
+    proxy = qobject_cast<KCModuleProxy*>(moduleScroll->widget());
     Q_ASSERT(proxy);
     QVariant value;
     value.setValue(m_proxyService);
EOF

debchange -i

# (you need change the first line with: ktp-text-ui (4:17.12.3-0ubuntu2) bionic; urgency=medium)

dpkg-source --commit
debuild -us -uc -i -I
cd ..
dpkg -i kde-telepathy-text-ui_*.deb