Bug 409440 - Kile crash when closing files
Summary: Kile crash when closing files
Status: RESOLVED FIXED
Alias: None
Product: kile
Classification: Applications
Component: general (other bugs)
Version First Reported In: master
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Michel Ludwig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-03 07:09 UTC by Johannes Hirte
Modified: 2019-07-16 23:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Hirte 2019-07-03 07:09:55 UTC
SUMMARY

First observed when I quit Kile. It crashed reliable, when I have a project open. Some testing showed, that Kile crash if two ore more files are open and they're closed. Tried with closing Kile, closing a project with multiple files or just closing files. I could not reproduce this with only one file open.

STEPS TO REPRODUCE
1. open two or more files
2. close these files

OBSERVED RESULT
crash:

[KCrash Handler]
#7  0x0000000000000000 in ?? ()
#8  0x00007eff7498aa51 in KModifierKeyInfo::~KModifierKeyInfo (this=0x55eaf4de1c20, __in_chrg=<optimized out>) at /var/tmp/portage/kde-frameworks/kguiaddons-9999/work/kguiaddons-9999/src/util/kmodifierkeyinfo.cpp:57
#9  0x00007eff7498aa69 in KModifierKeyInfo::~KModifierKeyInfo (this=0x55eaf4de1c20, __in_chrg=<optimized out>) at /var/tmp/portage/kde-frameworks/kguiaddons-9999/work/kguiaddons-9999/src/util/kmodifierkeyinfo.cpp:55
#10 0x00007eff737022bc in QObjectPrivate::deleteChildren (this=this@entry=0x55eaf4de1cb0) at kernel/qobject.cpp:2016
#11 0x00007eff7370311f in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:1032
#12 0x00007eff7631fd43 in LaTeXEventFilter::~LaTeXEventFilter (this=0x55eaf4ddf680, __in_chrg=<optimized out>) at src/kdeinit_kile_autogen/EWIEGA46WW/../../../../kile-9999/src/eventfilter.h:35
#13 LaTeXEventFilter::~LaTeXEventFilter (this=0x55eaf4ddf680, __in_chrg=<optimized out>) at src/kdeinit_kile_autogen/EWIEGA46WW/../../../../kile-9999/src/eventfilter.h:35
#14 0x00007eff737022bc in QObjectPrivate::deleteChildren (this=this@entry=0x55eaf4ccbfe0) at kernel/qobject.cpp:2016
#15 0x00007eff7407f0e5 in QWidget::~QWidget (this=0x55eaf4392680, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1708
#16 0x00007eff753226f1 in KTextEditor::ViewPrivate::~ViewPrivate (this=0x55eaf4392680, __in_chrg=<optimized out>) at /var/tmp/portage/kde-frameworks/ktexteditor-9999/work/ktexteditor-9999/src/view/kateview.cpp:251
#17 0x00007eff764da2aa in KileView::Manager::removeView (this=this@entry=0x55eaf2d81dc0, view=0x55eaf4392680) at /var/tmp/portage/app-editors/kile-9999/work/kile-9999/src/kileviewmanager.cpp:602
#18 0x00007eff76479dc9 in KileDocument::Manager::fileClose (this=0x55eaf2c945a0, doc=0x55eaf495f1d0, closingproject=<optimized out>) at /usr/include/qt5/QtCore/qlist.h:235
#19 0x00007eff736fb6d7 in QtPrivate::QSlotObjectBase::call (a=0x7ffe83522150, r=0x55eaf2d81dc0, this=0x55eaf4290780) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
#20 QMetaObject::activate (sender=0x55eaf42916c0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3781
#21 0x00007eff741edba1 in QTabBar::tabCloseRequested (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qtabbar.cpp:344
#22 0x00007eff736fb59b in QMetaObject::activate (sender=0x55eaf4d33a00, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3801
#23 0x00007eff74131c4a in QAbstractButton::clicked (this=this@entry=0x55eaf4d33a00, _t1=<optimized out>) at .moc/moc_qabstractbutton.cpp:312
#24 0x00007eff74131e62 in QAbstractButtonPrivate::emitClicked (this=this@entry=0x55eaf4c8a9a0) at widgets/qabstractbutton.cpp:414
#25 0x00007eff7413317a in QAbstractButtonPrivate::click (this=0x55eaf4c8a9a0) at widgets/qabstractbutton.cpp:407
#26 0x00007eff74133349 in QAbstractButton::mouseReleaseEvent (this=0x55eaf4d33a00, e=0x7ffe83522800) at widgets/qabstractbutton.cpp:1011
#27 0x00007eff7408370e in QWidget::event (this=0x55eaf4d33a00, event=0x7ffe83522800) at kernel/qwidget.cpp:8963
#28 0x00007eff74042952 in QApplicationPrivate::notify_helper (this=this@entry=0x55eaf2b91990, receiver=receiver@entry=0x55eaf4d33a00, e=e@entry=0x7ffe83522800) at kernel/qapplication.cpp:3737
#29 0x00007eff7404baf9 in QApplication::notify (this=<optimized out>, receiver=0x55eaf4d33a00, e=0x7ffe83522800) at kernel/qapplication.cpp:3197
#30 0x00007eff736d266f in QCoreApplication::notifyInternal2 (receiver=0x55eaf4d33a00, event=0x7ffe83522800) at kernel/qcoreapplication.cpp:1084
#31 0x00007eff7404ac01 in QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x55eaf4d33a00, event=event@entry=0x7ffe83522800, alienWidget=alienWidget@entry=0x55eaf4d33a00, nativeWidget=0x55eaf2c45a10, buttonDown=buttonDown@entry=0x7eff74558990 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2683
#32 0x00007eff7409ea5c in QWidgetWindow::handleMouseEvent (this=0x55eaf2b8be40, event=0x7ffe83522c90) at /usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/include/g++-v9/bits/atomic_base.h:413
#33 0x00007eff740a16ac in QWidgetWindow::event (event=0x7ffe83522c90, this=0x55eaf2b8be40) at kernel/qwidgetwindow.cpp:281
#34 QWidgetWindow::event (this=0x55eaf2b8be40, event=0x7ffe83522c90) at kernel/qwidgetwindow.cpp:224
#35 0x00007eff74042952 in QApplicationPrivate::notify_helper (this=this@entry=0x55eaf2b91990, receiver=receiver@entry=0x55eaf2b8be40, e=e@entry=0x7ffe83522c90) at kernel/qapplication.cpp:3737
#36 0x00007eff7404b8c0 in QApplication::notify (this=0x7ffe83523160, receiver=0x55eaf2b8be40, e=0x7ffe83522c90) at kernel/qapplication.cpp:3483
#37 0x00007eff736d266f in QCoreApplication::notifyInternal2 (receiver=0x55eaf2b8be40, event=0x7ffe83522c90) at kernel/qcoreapplication.cpp:1084
#38 0x00007eff73a98948 in QGuiApplicationPrivate::processMouseEvent (e=e@entry=0x55eaf4ede5c0) at kernel/qguiapplication.cpp:2107
#39 0x00007eff73a99ceb in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x55eaf4ede5c0) at kernel/qguiapplication.cpp:1842
#40 0x00007eff73a7772a in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1151
#41 0x00007eff6bb5a66a in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#42 0x00007eff708c616d in g_main_dispatch (context=0x7eff64004ff0) at /var/tmp/portage/dev-libs/glib-2.58.3/work/glib-2.58.3/glib/gmain.c:3182
#43 g_main_context_dispatch (context=context@entry=0x7eff64004ff0) at /var/tmp/portage/dev-libs/glib-2.58.3/work/glib-2.58.3/glib/gmain.c:3847
#44 0x00007eff708c6400 in g_main_context_iterate (context=context@entry=0x7eff64004ff0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.58.3/work/glib-2.58.3/glib/gmain.c:3920
#45 0x00007eff708c648c in g_main_context_iteration (context=0x7eff64004ff0, may_block=may_block@entry=1) at /var/tmp/portage/dev-libs/glib-2.58.3/work/glib-2.58.3/glib/gmain.c:3981
#46 0x00007eff73724b31 in QEventDispatcherGlib::processEvents (this=0x55eaf2c2e7e0, flags=...) at kernel/qeventdispatcher_glib.cpp:422
#47 0x00007eff736d1693 in QEventLoop::exec (this=this@entry=0x7ffe83523050, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140
#48 0x00007eff736d8ff7 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:120
#49 0x00007eff73a8e3dc in QGuiApplication::exec () at kernel/qguiapplication.cpp:1784
#50 0x00007eff740428c5 in QApplication::exec () at kernel/qapplication.cpp:2893
#51 0x00007eff764f87d8 in kdemain (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/app-editors/kile-9999/work/kile-9999/src/main.cpp:202
#52 0x00007eff760acebe in __libc_start_main (main=0x55eaf195c060 <main>, argc=1, argv=0x7ffe83523348, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe83523338) at ../csu/libc-start.c:308
#53 0x000055eaf195c09a in _start ()


EXPECTED RESULT

obviously no crash

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Gentoo Linux
(available in About System)
KDE Plasma Version: git master (>v5.16.2)
KDE Frameworks Version: git master (>v5.59.0-rc1)
Qt Version: 5.12.4

ADDITIONAL INFORMATION
Comment 1 Johannes Hirte 2019-07-03 14:24:22 UTC
the bad behaviour was introduced with this change in kguiaddons:

commit 0fe2990dbad992a4925a7b7bee09b1cdfbe5a7a7
Author: Aleix Pol <aleixpol@kde.org>
Date:   Fri Jun 21 15:57:22 2019 +0200

    Move to runtime the decision to use x11 or not
    
    Summary:
    Instead of deciding at build time which backend to use, see which is
    used upon construction.
    This will make it possible to have an alternative wayland
    implementation.
    
    Test Plan: See D20442
    
    Subscribers: kde-frameworks-devel
    
    Tags: #frameworks
    
    Differential Revision: https://phabricator.kde.org/D20443
Comment 2 Johannes Hirte 2019-07-03 15:52:32 UTC
possible fix

diff --git a/src/eventfilter.cpp b/src/eventfilter.cpp
index 62dc724e..5ad1d514 100644
--- a/src/eventfilter.cpp
+++ b/src/eventfilter.cpp
@@ -32,7 +32,7 @@
 
 LaTeXEventFilter::LaTeXEventFilter(KTextEditor::View *view, KileDocument::EditorExtension *edit) : QObject(view), m_view(view), m_edit(edit)
 {
-    m_modifierKeyInfo = new KModifierKeyInfo(this);
+    m_modifierKeyInfo = new KModifierKeyInfo(nullptr);
     readConfig();
 }
Comment 3 Kai Uwe Broulik 2019-07-04 07:25:45 UTC
That patch will just leak the instance. A proper fix would be in KModifierKeyInfo.
Comment 4 Johannes Hirte 2019-07-04 11:44:39 UTC
(In reply to Kai Uwe Broulik from comment #3)
> That patch will just leak the instance. A proper fix would be in
> KModifierKeyInfo.

Yes, I've mixed something up when reading the code.
Comment 5 Johannes Hirte 2019-07-16 23:16:19 UTC
fixed in kguiaddons with commit:

commit 7ecff22e72158dd01492e1a7747b77e0d67acdad
Author: Aleix Pol <aleixpol@kde.org>
Date:   Wed Jul 3 17:13:15 2019 +0200

    KModifierKeyInfo: we are sharing the internal implementation
    
    Summary: Use data types that will only destroy it when necessary.
    
    Reviewers: broulik
    
    Subscribers: davidedmundson, kde-frameworks-devel
    
    Tags: #frameworks
    
    Differential Revision: https://phabricator.kde.org/D22241