Bug 321699

Summary: System Settings crashes on primary display change
Product: [Plasma] KScreen Reporter: Aleksi Uotila <aleksi.uotila>
Component: libkscreenAssignee: Alex Fiestas <afiestas>
Status: RESOLVED FIXED    
Severity: crash CC: dvratil
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.1

Description Aleksi Uotila 2013-06-28 07:27:54 UTC
Application: systemsettings (1.0)
KDE Platform Version: 4.10.3
Qt Version: 4.8.4
Operating System: Linux 3.8.0-23-generic x86_64
Distribution: Ubuntu 13.04

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

Before I changed my display port cable on primary display from normal display port cable to a dvi cable with display port adapter (on computer end the same port being used - on monitor end changed from display port to dvi). I also have another display with DVI - DVI connection. This another monitor was secondary display before the change but it got changed to primary I guess when I unplugged the display port cable.

I didn't reboot the machine in between the cable change and this system settings crash.

System settings app crashes when Apply is pressed on monitor settings (primary monitor change on monitor settings before Apply).

The settings app crashes probably because xrandr is unable to switch the primary too:
$ xrandr --output DisplayPort-0 --primary --right-of DVI-0 
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  21 (RRSetCrtcConfig)
  Serial number of failed request:  27
  Current serial number in output stream:  27

$ xrandr --output DisplayPort-0 --primary 
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  21 (RRSetCrtcConfig)
  Serial number of failed request:  27
  Current serial number in output stream:  27
$ xrandr --output D
DisplayPort-0  DVI-0          
$ xrandr --output DVI-0 --left-of DisplayPort-0 
$

The crash can be reproduced every time.

-- Backtrace:
Application: System Settings (systemsettings), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f5eaa21e7c0 (LWP 5102))]

Thread 3 (Thread 0x7f5e8cfbe700 (LWP 5103)):
#0  0x00007f5ea721f3cd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f5ea02511dc in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f5ea0251304 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f5ea79a4036 in QEventDispatcherGlib::processEvents (this=0x7f5e880008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#4  0x00007f5ea797438f in QEventLoop::processEvents (this=this@entry=0x7f5e8cfbdd90, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f5ea7974618 in QEventLoop::exec (this=this@entry=0x7f5e8cfbdd90, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f5ea7876410 in QThread::exec (this=this@entry=0x2288100) at thread/qthread.cpp:542
#7  0x00007f5ea7955edf in QInotifyFileSystemWatcherEngine::run (this=0x2288100) at io/qfilesystemwatcher_inotify.cpp:256
#8  0x00007f5ea7878bec in QThreadPrivate::start (arg=0x2288100) at thread/qthread_unix.cpp:338
#9  0x00007f5ea0723f8e in start_thread (arg=0x7f5e8cfbe700) at pthread_create.c:311
#10 0x00007f5ea722be1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 2 (Thread 0x7f5e87fff700 (LWP 5118)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f5ea4aece77 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#2  0x00007f5ea4aecea9 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#3  0x00007f5ea0723f8e in start_thread (arg=0x7f5e87fff700) at pthread_create.c:311
#4  0x00007f5ea722be1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 1 (Thread 0x7f5eaa21e7c0 (LWP 5102)):
[KCrash Handler]
#6  KScreen::Mode::size (this=0x0) at /build/buildd/libkscreen-0.0.92/src/mode.cpp:83
#7  0x00007f5e8c185719 in XRandRConfig::applyKScreenConfig (this=0x23b6c10, config=0x23f7460) at /build/buildd/libkscreen-0.0.92/backends/xrandr/xrandrconfig.cpp:164
#8  0x00007f5e8c396fd5 in KScreen::Config::setConfig (config=0x23f7460) at /build/buildd/libkscreen-0.0.92/src/config.cpp:66
#9  0x00007f5e8c5ae409 in KCMKScreen::save (this=0x23c6d30) at /build/buildd/kscreen-0.0.92/kcm/src/kcm_kscreen.cpp:213
#10 0x00007f5ea9938807 in KCModuleProxy::save (this=<optimized out>) at ../../kutils/kcmoduleproxy.cpp:279
#11 0x00007f5ea97105b3 in ModuleView::moduleSave(KCModuleProxy*) () from /usr/lib/libsystemsettingsview.so.2
#12 0x00007f5ea97120da in ?? () from /usr/lib/libsystemsettingsview.so.2
#13 0x00007f5ea798a0ef in QMetaObject::activate (sender=sender@entry=0x20681c0, m=m@entry=0x7f5ea90a4ca0 <QAbstractButton::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7fff16795dd0) at kernel/qobject.cpp:3539
#14 0x00007f5ea8c44c82 in QAbstractButton::clicked (this=this@entry=0x20681c0, _t1=false) at .moc/release-shared/moc_qabstractbutton.cpp:220
#15 0x00007f5ea899823e in QAbstractButtonPrivate::emitClicked (this=this@entry=0x2081ca0) at widgets/qabstractbutton.cpp:548
#16 0x00007f5ea8998a30 in QAbstractButtonPrivate::click (this=this@entry=0x2081ca0) at widgets/qabstractbutton.cpp:541
#17 0x00007f5ea8998c9c in QAbstractButton::mouseReleaseEvent (this=0x20681c0, e=0x7fff16796670) at widgets/qabstractbutton.cpp:1123
#18 0x00007f5ea8626a89 in QWidget::event (this=0x20681c0, event=0x7fff16796670) at kernel/qwidget.cpp:8375
#19 0x00007f5ea85d98ec in QApplicationPrivate::notify_helper (this=this@entry=0x1c70d30, receiver=receiver@entry=0x20681c0, e=e@entry=0x7fff16796670) at kernel/qapplication.cpp:4567
#20 0x00007f5ea85dca33 in QApplication::notify (this=this@entry=0x7fff167972e0, receiver=receiver@entry=0x20681c0, e=e@entry=0x7fff16796670) at kernel/qapplication.cpp:4110
#21 0x00007f5ea92e6af6 in KApplication::notify (this=0x7fff167972e0, receiver=0x20681c0, event=0x7fff16796670) at ../../kdeui/kernel/kapplication.cpp:311
#22 0x00007f5ea797563e in QCoreApplication::notifyInternal (this=0x7fff167972e0, receiver=receiver@entry=0x20681c0, event=event@entry=0x7fff16796670) at kernel/qcoreapplication.cpp:946
#23 0x00007f5ea85df933 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#24 QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x20681c0, event=event@entry=0x7fff16796670, alienWidget=alienWidget@entry=0x20681c0, nativeWidget=nativeWidget@entry=0x1dc9d80, buttonDown=buttonDown@entry=0x7f5ea90b7308 <qt_button_down>, lastMouseReceiver=..., spontaneous=spontaneous@entry=true) at kernel/qapplication.cpp:3178
#25 0x00007f5ea8654ec4 in QETWidget::translateMouseEvent (this=this@entry=0x1dc9d80, event=event@entry=0x7fff16796df0) at kernel/qapplication_x11.cpp:4631
#26 0x00007f5ea8653ef1 in QApplication::x11ProcessEvent (this=0x7fff167972e0, event=event@entry=0x7fff16796df0) at kernel/qapplication_x11.cpp:3746
#27 0x00007f5ea867f0b2 in x11EventSourceDispatch (s=0x1c56ff0, callback=0x0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#28 0x00007f5ea0250f05 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f5ea0251248 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007f5ea0251304 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007f5ea79a4016 in QEventDispatcherGlib::processEvents (this=0x1c17ad0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#32 0x00007f5ea867f1ae in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#33 0x00007f5ea797438f in QEventLoop::processEvents (this=this@entry=0x7fff167971c0, flags=...) at kernel/qeventloop.cpp:149
#34 0x00007f5ea7974618 in QEventLoop::exec (this=this@entry=0x7fff167971c0, flags=...) at kernel/qeventloop.cpp:204
#35 0x00007f5ea7979cf6 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#36 0x000000000040aa2e in ?? ()
#37 0x00007f5ea7153ea5 in __libc_start_main (main=0x40a6d0, argc=5, ubp_av=0x7fff16797428, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff16797418) at libc-start.c:260
#38 0x000000000040aa85 in _start ()

Reported using DrKonqi
Comment 1 Daniel Vrátil 2013-06-28 10:55:43 UTC

*** This bug has been marked as a duplicate of bug 320537 ***
Comment 2 Daniel Vrátil 2013-06-28 10:56:27 UTC
(Sorry, not a dupe)
Comment 3 Alex Fiestas 2013-07-25 20:14:38 UTC

*** This bug has been marked as a duplicate of bug 321708 ***
Comment 4 Alex Fiestas 2013-07-25 20:58:23 UTC
Git commit d9b3fc64ba1bf88805478cafd0545857c0eb71be by Àlex Fiestas.
Committed on 25/07/2013 at 20:50.
Pushed by afiestas into branch 'master'.

Use the information from currentOutput, not from the unapplied config

Before this patch, we were looking for the size of the current Mode
in the Output object of the config that is passed to Config::setConfig
which either can or can't have the wanted Mode.

This has been kinda working so far because and ONLY because in
Generator (from kscreen/kded) we use the currentConfig as the base for
the config that we are generating, so all modes are included.

CCMAIL: dvratil@redhat.com
Related: bug 320537, bug 321708
FIXED-IN: 1.0.1

M  +1    -1    backends/xrandr/xrandrconfig.cpp
M  +5    -0    backends/xrandr/xrandrmode.cpp
M  +1    -0    backends/xrandr/xrandrmode.h
M  +10   -0    backends/xrandr/xrandroutput.cpp
M  +1    -0    backends/xrandr/xrandroutput.h

http://commits.kde.org/libkscreen/d9b3fc64ba1bf88805478cafd0545857c0eb71be