The 'Open With' dialog opened by KMail triggers the following crash
for me:
#0 0x0000555568ea4220 in ?? () #1 0x00007ffff549bd60 in QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType) () from /usr/lib/libQt5Core.so.5 #2 0x00007ffff71287f4 in KLineEdit::setCompletionObject (this=0x555568ee8c00, comp=0x555568ea1320, handle=<optimized out>) at /home/milian/projects/kf5/src/frameworks/kcompletion/src/klineedit.cpp:1514 #3 0x00007ffff7113d35 in KComboBox::setLineEdit (this=0x555568ea3ba0, edit=0x555568ee8c00) at /home/milian/projects/kf5/src/frameworks/kcompletion/src/kcombobox.cpp:325 #4 0x00007ffff784ef63 in KOpenWithDialogPrivate::init (this=0x7fff70240440, _text="<qt>Select the program you want to use to open the file<br/>DebuggingProfilingWindows-2017-WK50.pdf</qt>", _value="") at /home/milian/projects/kf5/src/frameworks/kio/src/widgets/kopenwithdialog.cpp:601 #5 0x00007ffff784f93c in KOpenWithDialog::KOpenWithDialog (this=0x7fffffffba50, _urls=QList<QUrl> = {...}, _text=..., _value="", parent=<optimized out>) at /home/milian/projects/kf5/src/frameworks/kio/src/widgets/kopenwithdialog.cpp:531 #6 0x00007ffff7862b51 in KRun::displayOpenWithDialog (lst=QList<QUrl> = {...}, window=0x55555599a690, tempFiles=tempFiles@entry=true, suggestedFileName="", asn=<QArrayData::shared_null+24> "") at /home/milian/projects/kf5/src/frameworks/kio/src/widgets/krun.cpp:267
This happens when an editable KComboBox is initialized (i.e.
KHistoryComboBox in this case). When we then ask for the completionObject,
this will alias the lineEdit's completion object, which gets destroyed by
the call to QComboBox::setLineEdit, leading to the crash above.
Overall, I think the whole aliasing / delegation here is quite
confusing and I'm unsure as to what the desired behavior is here.
Should we transfer ownership to the new line edit, if it has no
compObj of its own?
The unit test is extended to catch this scenario now. It at least
ensures that nothing crashes and also documents the status quo
of the behavior right now.