Bug 391447

Summary: konsole crash when pasting text
Product: [Applications] konsole Reporter: rainer+kdebugs
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: crash Keywords: drkonqi
Priority: NOR    
Version: 17.04.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description rainer+kdebugs 2018-03-05 17:33:01 UTC
Application: konsole (17.04.3)

Qt Version: 5.9.1
Frameworks Version: 5.38.0
Operating System: Linux 4.13.0-36-generic x86_64
Distribution: Ubuntu 17.10

-- Information about the crash:
- What I was doing when the application crashed:

konsole on Ubuntu artsy crashed when attempting to copy a relatively small (98 bytes if I'm not mistaken) HTML-element from the Chromium inspector via Ctrl+Shift+V into vim.  konsole may have been running for 1 week and appears to have collected ~10MB of history in /tmp/konsole-*.history

-- Backtrace:
Application: Konsole (konsole), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f1bba606540 (LWP 7332))]

Thread 3 (Thread 0x7f1b9e16c700 (LWP 7334)):
#0  g_mutex_unlock (mutex=0x7f1b98000be0) at ../../../../glib/gthread-posix.c:1348
#1  0x00007f1bb008d15e in g_main_context_poll (priority=<optimized out>, n_fds=1, fds=0x7f1b98002de0, timeout=<optimized out>, context=0x7f1b98000be0) at ../../../../glib/gmain.c:4186
#2  g_main_context_iterate (context=context@entry=0x7f1b98000be0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../../glib/gmain.c:3881
#3  0x00007f1bb008d27c in g_main_context_iteration (context=0x7f1b98000be0, may_block=may_block@entry=1) at ../../../../glib/gmain.c:3947
#4  0x00007f1bb649c49b in QEventDispatcherGlib::processEvents (this=0x7f1b98000b10, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#5  0x00007f1bb6441e3a in QEventLoop::exec (this=this@entry=0x7f1b9e16bc80, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#6  0x00007f1bb62613ca in QThread::exec (this=<optimized out>) at thread/qthread.cpp:515
#7  0x00007f1bb4605e45 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#8  0x00007f1bb626629d in QThreadPrivate::start (arg=0x7f1bb4878d60) at thread/qthread_unix.cpp:368
#9  0x00007f1bb1d007fc in start_thread (arg=0x7f1b9e16c700) at pthread_create.c:465
#10 0x00007f1bb9f28b5f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f1ba54ac700 (LWP 7333)):
#0  0x00007f1bb9f1c951 in __GI___poll (fds=fds@entry=0x7f1ba54abbb8, nfds=nfds@entry=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f1bb2126747 in poll (__timeout=-1, __nfds=1, __fds=0x7f1ba54abbb8) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
#2  _xcb_conn_wait (c=c@entry=0x555e38fe7df0, cond=cond@entry=0x555e38fe7e30, vector=vector@entry=0x0, count=count@entry=0x0) at ../../src/xcb_conn.c:479
#3  0x00007f1bb212853a in xcb_wait_for_event (c=0x555e38fe7df0) at ../../src/xcb_in.c:693
#4  0x00007f1ba7a06f09 in QXcbEventReader::run (this=0x555e38ff2f50) at qxcbconnection.cpp:1322
#5  0x00007f1bb626629d in QThreadPrivate::start (arg=0x555e38ff2f50) at thread/qthread_unix.cpp:368
#6  0x00007f1bb1d007fc in start_thread (arg=0x7f1ba54ac700) at pthread_create.c:465
#7  0x00007f1bb9f28b5f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f1bba606540 (LWP 7332)):
[KCrash Handler]
#6  QFlags<Konsole::ProcessInfo::Field>::testFlag (f=<optimized out>, this=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qflags.h:150
#7  Konsole::ProcessInfo::name (this=0x0, ok=ok@entry=0x7fffa98d4377) at ./src/ProcessInfo.cpp:204
#8  0x00007f1bb9b78bd1 in Konsole::Session::getUrl (this=0x555e39808630) at ./src/Session.cpp:1094
#9  0x00007f1bb9b7f36a in Konsole::SessionController::url (this=<optimized out>) at ./src/SessionController.cpp:279
#10 0x00007f1bb9b2823b in Konsole::BookmarkHandler::titleForView (this=<optimized out>, view=<optimized out>) at ./src/BookmarkHandler.cpp:114
#11 0x00007f1bb9b28641 in Konsole::BookmarkHandler::currentTitle (this=<optimized out>) at ./src/BookmarkHandler.cpp:109
#12 0x00007f1bb59bdfef in KBookmarkMenu::slotAddBookmark (this=<optimized out>, this=<optimized out>) at ./src/kbookmarkmenu.cpp:396
#13 0x00007f1bb64728e5 in QMetaObject::activate (sender=sender@entry=0x555e3a4d9560, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7fffa98d4670) at kernel/qobject.cpp:3766
#14 0x00007f1bb6472fb7 in QMetaObject::activate (sender=sender@entry=0x555e3a4d9560, m=m@entry=0x7f1bb7b0ede0 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7fffa98d4670) at kernel/qobject.cpp:3628
#15 0x00007f1bb7447d82 in QAction::triggered (this=this@entry=0x555e3a4d9560, _t1=<optimized out>) at .moc/moc_qaction.cpp:371
#16 0x00007f1bb744a46c in QAction::activate (this=0x555e3a4d9560, event=<optimized out>) at kernel/qaction.cpp:1159
#17 0x00007f1bb744ad15 in QAction::event (this=<optimized out>, e=<optimized out>) at kernel/qaction.cpp:1087
#18 0x00007f1bb744e46c in QApplicationPrivate::notify_helper (this=this@entry=0x555e38fd7ea0, receiver=receiver@entry=0x555e3a4d9560, e=e@entry=0x7fffa98d4920) at kernel/qapplication.cpp:3717
#19 0x00007f1bb7455d34 in QApplication::notify (this=0x555e38fd7e80, receiver=0x555e3a4d9560, e=0x7fffa98d4920) at kernel/qapplication.cpp:3476
#20 0x00007f1bb6443de8 in QCoreApplication::notifyInternal2 (receiver=0x555e3a4d9560, event=event@entry=0x7fffa98d4920) at kernel/qcoreapplication.cpp:1018
#21 0x00007f1bb6cc0d77 in QCoreApplication::sendEvent (event=0x7fffa98d4920, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:233
#22 QShortcutMap::dispatchEvent (this=this@entry=0x555e38fd7f78, e=e@entry=0x7fffa98d49d0) at kernel/qshortcutmap.cpp:674
#23 0x00007f1bb6cc0e4a in QShortcutMap::tryShortcut (this=this@entry=0x555e38fd7f78, e=e@entry=0x7fffa98d49d0) at kernel/qshortcutmap.cpp:351
#24 0x00007f1bb6c70473 in QWindowSystemInterface::handleShortcutEvent (window=<optimized out>, window@entry=0x555e3a668960, timestamp=402700243, keyCode=66, modifiers=..., nativeScanCode=56, nativeVirtualKey=66, nativeModifiers=5, text=..., autorepeat=false, count=1) at kernel/qwindowsysteminterface.cpp:375
#25 0x00007f1bb6c8f9b7 in QGuiApplicationPrivate::processKeyEvent (e=0x7f1ba00be1d0) at kernel/qguiapplication.cpp:2056
#26 0x00007f1bb6c94a05 in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x7f1ba00be1d0) at kernel/qguiapplication.cpp:1739
#27 0x00007f1bb6c6ccab in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at kernel/qwindowsysteminterface.cpp:939
#28 0x00007f1ba7a695a0 in userEventSourceDispatch (source=source@entry=0x555e39022880) at qeventdispatcher_glib.cpp:77
#29 0x00007f1bb008cfb7 in g_main_dispatch (context=0x7f1ba0004fc0) at ../../../../glib/gmain.c:3148
#30 g_main_context_dispatch (context=context@entry=0x7f1ba0004fc0) at ../../../../glib/gmain.c:3813
#31 0x00007f1bb008d1f0 in g_main_context_iterate (context=context@entry=0x7f1ba0004fc0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../../glib/gmain.c:3886
#32 0x00007f1bb008d27c in g_main_context_iteration (context=0x7f1ba0004fc0, may_block=may_block@entry=1) at ../../../../glib/gmain.c:3947
#33 0x00007f1bb649c47f in QEventDispatcherGlib::processEvents (this=0x555e3901c2a0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#34 0x00007f1bb6441e3a in QEventLoop::exec (this=this@entry=0x7fffa98d4d90, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#35 0x00007f1bb644ada4 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1291
#36 0x00007f1bb6c8a11c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1679
#37 0x00007f1bb744e3c5 in QApplication::exec () at kernel/qapplication.cpp:2905
#38 0x00007f1bba21c130 in kdemain (argc=<optimized out>, argv=<optimized out>) at ./src/main.cpp:183
#39 0x00007f1bb9e351c1 in __libc_start_main (main=0x555e386f3730 <main>, argc=1, argv=0x7fffa98d5048, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffa98d5038) at ../csu/libc-start.c:308
#40 0x0000555e386f376a in _start ()

Reported using DrKonqi
Comment 1 Kurt Hindenburg 2018-04-14 10:25:23 UTC
Git commit 916ff8f8295eaecc0eb7c3807f4a7a6e4fe408b4 by Kurt Hindenburg, on behalf of Ahmad Samir.
Committed on 14/04/2018 at 10:25.
Pushed by hindenburg into branch 'master'.

Check for valid _foregroundProcessInfo to prevent crash

Summary:
In Session::getUrl() check that _foregroundProcessInfo is valid before
tyring to access its members.

I couldn't reproduce the crash from the BR, but it is logical to call
isValid() before accessing any ProcessInfo object members.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D12175

M  +1    -1    src/Session.cpp

https://commits.kde.org/konsole/916ff8f8295eaecc0eb7c3807f4a7a6e4fe408b4