Bug 313996

Summary: KScreen crashes KWin when switching between resolution options
Product: [Plasma] kwin Reporter: Darin Miller <darinsmiller>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: darinsmiller, jessie
Priority: NOR    
Version: 4.9.5   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.10
Sentry Crash Report:
Attachments: New crash information added by DrKonqi
New crash information added by DrKonqi

Description Darin Miller 2013-01-27 19:44:10 UTC
Application: kwin (4.9.5)
KDE Platform Version: 4.9.5
Qt Version: 4.8.3
Operating System: Linux 3.5.0-21-generic x86_64
Distribution: Ubuntu 12.10

-- Information about the crash:
Right after plugging in HDMI cable into a Dell M1530 laptop, KScreen automatically and correctly set the external monitor to its "saved" setting (Primary on the left).   KWin immediately crashed. To KWin's credit, it recovered (auto restarted) nicely with no observeable side affects.

Another nearly identiacal laptop (hardware wise) suffered the same issue when HDMI monitor was unplugged.  Both laptops are running Kubuntu 12.10 and 13.04 with NVida proprietary drivers, version 313.19, 310.14 repectively.

The crash can be reproduced some of the time.

-- Backtrace:
Application: KWin (kwin), signal: Floating point exception
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fd7a79257c0 (LWP 7249))]

Thread 2 (Thread 0x7fd79d327700 (LWP 7256)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fd7b9843cd7 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#2  0x00007fd7b9843d09 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#3  0x00007fd7b1888e9a in start_thread (arg=0x7fd79d327700) at pthread_create.c:308
#4  0x00007fd7bc91acbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fd7a79257c0 (LWP 7249)):
[KCrash Handler]
#6  0x00007fd7bcc4ec36 in KWin::currentRefreshRate () at ../../kwin/options.cpp:75
#7  0x00007fd7bcc54efe in KWin::Workspace::workspaceEvent (this=0x24df8e0, e=0x7fffc5153bf0) at ../../kwin/events.cpp:466
#8  0x00007fd7bcc46848 in KWin::Application::x11EventFilter (this=0x7fffc5154150, e=0x7fffc5153bf0) at ../../kwin/main.cpp:362
#9  0x00007fd7b78eb7bc in qt_x11EventFilter (ev=0x7fffc5153bf0) at kernel/qapplication_x11.cpp:441
#10 qt_x11EventFilter (ev=0x7fffc5153bf0) at kernel/qapplication_x11.cpp:429
#11 0x00007fd7b78fb7f0 in QApplication::x11ProcessEvent (this=0x7fffc5154150, event=0x7fffc5153bf0) at kernel/qapplication_x11.cpp:3449
#12 0x00007fd7b79249d9 in QEventDispatcherX11::processEvents (this=0x2341ad0, flags=...) at kernel/qeventdispatcher_x11.cpp:132
#13 0x00007fd7b84d62bf in QEventLoop::processEvents (this=this@entry=0x7fffc5153e60, flags=...) at kernel/qeventloop.cpp:149
#14 0x00007fd7b84d6548 in QEventLoop::exec (this=0x7fffc5153e60, flags=...) at kernel/qeventloop.cpp:204
#15 0x00007fd7b84db708 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#16 0x00007fd7bcc48ed4 in kdemain (argc=3, argv=0x7fffc5154298) at ../../kwin/main.cpp:545
#17 0x00007fd7bc84876d in __libc_start_main (main=0x4006a0 <main(int, char**)>, argc=3, ubp_av=0x7fffc5154298, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffc5154288) at libc-start.c:226
#18 0x00000000004006d1 in _start ()

Possible duplicates by query: bug 293654.

Reported using DrKonqi
Comment 1 Darin Miller 2013-01-27 19:58:25 UTC
Created attachment 76759 [details]
New crash information added by DrKonqi

kwin (4.9.98) on KDE Platform 4.9.98 using Qt 4.8.4

After installing KScreen, I unplugged external monitor and KWin crashed (but KWin recovered gracefully).

-- Backtrace (Reduced):
#6  0x00007f0e8f1afd06 in KWin::currentRefreshRate () at ../../kwin/options.cpp:75
#7  0x00007f0e8f1b5ff8 in KWin::Workspace::workspaceEvent (this=0x1c8d6b0, e=0x7fff0d12f530) at ../../kwin/events.cpp:469
#8  0x00007f0e8f1a7778 in KWin::Application::x11EventFilter (this=0x7fff0d12fa90, e=0x7fff0d12f530) at ../../kwin/main.cpp:362
#9  0x00007f0e895d695c in qt_x11EventFilter (ev=0x7fff0d12f530) at kernel/qapplication_x11.cpp:441
#10 qt_x11EventFilter (ev=0x7fff0d12f530) at kernel/qapplication_x11.cpp:429
Comment 2 Thomas Lübking 2013-01-27 20:19:19 UTC
rate = 1000*dotclock/(modeline.htotal*vtotal);

Interesting - apparently at least interim XF86VidModeGetModeLine will return a NULL size display.
Not sure whether this should happen (xf86vm is a bit older than this modern "change resolutions" stuff ;-) but we should not crash on it.

Thanks for the report.
Comment 3 Jessie A. Morris 2013-02-05 16:12:52 UTC
Created attachment 76926 [details]
New crash information added by DrKonqi

kwin (4.9.98) on KDE Platform 4.9.98 using Qt 4.8.3

- What I was doing when the application crashed:
I close my laptop and open it, triggering a Kscreen "screens have changed" action to occur. It then crashes Kwin.

- Custom settings of the application:
I'm on a Thinkpad W510 with Nvidia Experimental 310 drivers.

-- Backtrace (Reduced):
#6  0x00007fe71490ccd6 in KWin::currentRefreshRate () at ../../kwin/options.cpp:75
#7  0x00007fe714912fd8 in KWin::Workspace::workspaceEvent (this=0x1d697e0, e=0x7fffee9220d0) at ../../kwin/events.cpp:469
#8  0x00007fe714904748 in KWin::Application::x11EventFilter (this=0x7fffee922630, e=0x7fffee9220d0) at ../../kwin/main.cpp:362
#9  0x00007fe70ed3e7bc in qt_x11EventFilter (ev=0x7fffee9220d0) at kernel/qapplication_x11.cpp:441
#10 qt_x11EventFilter (ev=0x7fffee9220d0) at kernel/qapplication_x11.cpp:429
Comment 4 Thomas Lübking 2013-02-05 16:34:12 UTC
commit 00a71b44b98a4d9fc96216a79c6e9236f64932d6
Author: Thomas Lübking <thomas.luebking@gmail.com>
Date:   Sun Jan 27 21:23:57 2013 +0100

    catch DIV by 0 for 0 dimension from modeline
    
    BUG :313996
          ^^^

meeehh - i misplaced the blank :-(
We nedd vim highlighting for this =)