Bug 326032 - Kwin crashes when moving a window on a dual screen
Summary: Kwin crashes when moving a window on a dual screen
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 4.11.2
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: drkonqi
: 333920 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-10-15 05:27 UTC by Stephan Peccini
Modified: 2015-09-14 20:07 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
New crash information added by DrKonqi (7.24 KB, text/plain)
2014-03-20 06:15 UTC, Jure Repinc
Details
possible patch (3.27 KB, patch)
2014-03-21 20:58 UTC, Thomas Lübking
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Peccini 2013-10-15 05:27:55 UTC
Application: kwin (4.11.2)
KDE Platform Version: 4.11.2
Qt Version: 4.8.5
Operating System: Linux 3.11.4-201.fc19.x86_64 x86_64
Distribution: "Fedora release 19 (Schrödinger’s Cat)"

-- Information about the crash:
- What I was doing when the application crashed:
I start my session on my laptop screen without the external screen.
When completed, I plug my second screen and organize by moving some windows from my external screen (which is the principal) to the laptop screen (same desktop but different screen). Kwin crashes during this operation; if it isn't during the first move, the second is the good one to produce the crash.

The crash can be reproduced every time.

-- Backtrace:
Application: KWin (kwin), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
81	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
[Current thread is 1 (Thread 0x7fdd592a18c0 (LWP 1900))]

Thread 2 (Thread 0x7fdd2943d700 (LWP 1914)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007fdd5826f0bb in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x7fdd5856cf00 <QTWTF::pageheap_memory>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#2  0x00007fdd5826f0f9 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#3  0x00007fdd52a62c53 in start_thread (arg=0x7fdd2943d700) at pthread_create.c:308
#4  0x00007fdd50c13e1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 1 (Thread 0x7fdd592a18c0 (LWP 1900)):
[KCrash Handler]
#6  KWin::PresentWindowsEffect::calculateWindowTransformationsClosest (this=this@entry=0x2bc4c80, windowlist=..., screen=1, motionManager=...) at /usr/src/debug/kde-workspace-4.11.2/kwin/effects/presentwindows/presentwindows.cpp:1006
#7  0x00007fdd2858e087 in KWin::PresentWindowsEffect::calculateWindowTransformations (this=0x2bc4c80, windowlist=..., screen=screen@entry=1, motionManager=..., external=external@entry=true) at /usr/src/debug/kde-workspace-4.11.2/kwin/effects/presentwindows/presentwindows.cpp:972
#8  0x00007fdd28594605 in KWin::PresentWindowsEffectProxy::calculateWindowTransformations (this=0x2bc4c90, windows=..., screen=screen@entry=1, manager=...) at /usr/src/debug/kde-workspace-4.11.2/kwin/effects/presentwindows/presentwindows_proxy.cpp:39
#9  0x00007fdd285a001b in KWin::DesktopGridEffect::setup (this=this@entry=0x2b903d0) at /usr/src/debug/kde-workspace-4.11.2/kwin/effects/desktopgrid/desktopgrid.cpp:1104
#10 0x00007fdd285a2073 in KWin::DesktopGridEffect::setActive (this=0x2b903d0, active=<optimized out>) at /usr/src/debug/kde-workspace-4.11.2/kwin/effects/desktopgrid/desktopgrid.cpp:1040
#11 0x00007fdd285a2363 in toggle (this=0x2b903d0) at /usr/src/debug/kde-workspace-4.11.2/kwin/effects/desktopgrid/desktopgrid.cpp:1026
#12 KWin::DesktopGridEffect::borderActivated (this=0x2b903d0, border=<optimized out>) at /usr/src/debug/kde-workspace-4.11.2/kwin/effects/desktopgrid/desktopgrid.cpp:753
#13 0x00007fdd53f25b73 in KWin::Effect::qt_static_metacall (_o=<optimized out>, _a=0x7fff44b823c0, _id=<optimized out>, _c=<optimized out>) at /usr/src/debug/kde-workspace-4.11.2/x86_64-redhat-linux-gnu/kwin/libkwineffects/kwineffects.moc:50
#14 0x00007fdd52df90f8 in QMetaMethod::invoke (this=this@entry=0x7fff44b825b0, object=object@entry=0x2b903d0, connectionType=Qt::DirectConnection, connectionType@entry=Qt::AutoConnection, returnValue=..., val0=..., val1=..., val2=..., val3=..., val4=..., val5=..., val6=..., val7=..., val8=..., val9=...) at kernel/qmetaobject.cpp:1664
#15 0x00007fdd52dfb5b8 in QMetaObject::invokeMethod (obj=0x2b903d0, member=<optimized out>, type=type@entry=Qt::AutoConnection, ret=..., val0=..., val1=..., val2=..., val3=..., val4=..., val5=..., val6=..., val7=..., val8=..., val9=...) at kernel/qmetaobject.cpp:1179
#16 0x00007fdd58e7aacb in invokeMethod (val9=..., val8=..., val7=..., val6=..., val5=..., val4=..., val3=..., val2=..., val1=..., val0=..., ret=..., member=<optimized out>, obj=<optimized out>) at /usr/include/QtCore/qobjectdefs.h:401
#17 KWin::Edge::handleByCallback (this=this@entry=0x2654a00) at /usr/src/debug/kde-workspace-4.11.2/kwin/screenedge.cpp:222
#18 0x00007fdd58e7bf00 in KWin::Edge::handle (this=this@entry=0x2654a00, cursorPos=...) at /usr/src/debug/kde-workspace-4.11.2/kwin/screenedge.cpp:181
#19 0x00007fdd58e7bf87 in KWin::Edge::check (this=0x2654a00, cursorPos=..., triggerTime=..., forceNoPushBack=<optimized out>) at /usr/src/debug/kde-workspace-4.11.2/kwin/screenedge.cpp:135
#20 0x00007fdd58e7c13d in KWin::ScreenEdges::handleEnterNotifiy (this=this@entry=0x254cbe0, window=31482314, point=..., timestamp=...) at /usr/src/debug/kde-workspace-4.11.2/kwin/screenedge.cpp:1011
#21 0x00007fdd58e7c303 in KWin::ScreenEdges::isEntered (this=0x254cbe0, e=e@entry=0x7fff44b82d60) at /usr/src/debug/kde-workspace-4.11.2/kwin/screenedge.cpp:976
#22 0x00007fdd58ddb02e in KWin::Workspace::workspaceEvent (this=0x25bde60, e=e@entry=0x7fff44b82d60) at /usr/src/debug/kde-workspace-4.11.2/kwin/events.cpp:306
#23 0x00007fdd58dcf920 in KWin::Application::x11EventFilter (this=0x7fff44b83150, e=0x7fff44b82d60) at /usr/src/debug/kde-workspace-4.11.2/kwin/main.cpp:422
#24 0x00007fdd51fe439c in qt_x11EventFilter (ev=0x7fff44b82d60) at kernel/qapplication_x11.cpp:435
#25 0x00007fdd51ff1e89 in QApplication::x11ProcessEvent (this=0x7fff44b83150, event=event@entry=0x7fff44b82d60) at kernel/qapplication_x11.cpp:3373
#26 0x00007fdd52019880 in QEventDispatcherX11::processEvents (this=0x23cec80, flags=...) at kernel/qeventdispatcher_x11.cpp:132
#27 0x00007fdd52defecf in QEventLoop::processEvents (this=this@entry=0x7fff44b82fc0, flags=...) at kernel/qeventloop.cpp:149
#28 0x00007fdd52df01c5 in QEventLoop::exec (this=this@entry=0x7fff44b82fc0, flags=...) at kernel/qeventloop.cpp:204
#29 0x00007fdd52df545b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1221
#30 0x00007fdd51f7ac9c in QApplication::exec () at kernel/qapplication.cpp:3823
#31 0x00007fdd58dd0806 in kdemain (argc=1, argv=0x7fff44b83298) at /usr/src/debug/kde-workspace-4.11.2/kwin/main.cpp:597
#32 0x00007fdd50b3fb75 in __libc_start_main (main=0x4009d0 <main(int, char**)>, argc=1, ubp_av=0x7fff44b83298, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff44b83288) at libc-start.c:274
#33 0x0000000000400a01 in _start ()

Possible duplicates by query: bug 314409.

Reported using DrKonqi
Comment 1 Thomas Lübking 2013-10-15 12:57:13 UTC
The backtrace says that the desktopgrid effec was starting up (active border/corner activation) what does not match your description of the actions leading to the crash, or does it?
Comment 2 Stephan Peccini 2013-10-15 13:03:49 UTC
Sorry, I wasn't precise in my description. I move my windows from screen to screen with the desktop grid activated; I have to check if I have the same problem without the grid. I will put the result as soon as possible.
Comment 3 Stephan Peccini 2013-10-29 15:21:09 UTC
I have no more problem; I don't know why, surely after an update. How to close it without tagging it as resolved?
Comment 4 Thomas Lübking 2013-10-29 16:07:23 UTC
Resolving as by comment #3
Feel free to just re-open the bug if it occurs again.
Comment 5 Jure Repinc 2014-03-20 06:15:49 UTC
Created attachment 85641 [details]
New crash information added by DrKonqi

kwin (4.11.7) on KDE Platform 4.12.90 using Qt 4.8.5

I started getting this crash now with KWin from 4.13 git branch. I plug in external laptop monitor via VGA port and then try to display desktop grid and I get the crash.

-- Backtrace (Reduced):
#6  KWin::PresentWindowsEffect::calculateWindowTransformationsClosest (this=this@entry=0x3379ac0, windowlist=..., screen=1, motionManager=...) at /var/tmp/portage/kde-base/kwin-4.11.49.9999/work/kwin-4.11.49.9999/kwin/effects/presentwindows/presentwindows.cpp:1013
#7  0x00007f717d910e54 in KWin::PresentWindowsEffect::calculateWindowTransformations (this=0x3379ac0, windowlist=..., screen=screen@entry=1, motionManager=..., external=external@entry=true) at /var/tmp/portage/kde-base/kwin-4.11.49.9999/work/kwin-4.11.49.9999/kwin/effects/presentwindows/presentwindows.cpp:979
#8  0x00007f717d9177c5 in KWin::PresentWindowsEffectProxy::calculateWindowTransformations (this=0x3379ad0, windows=..., screen=screen@entry=1, manager=...) at /var/tmp/portage/kde-base/kwin-4.11.49.9999/work/kwin-4.11.49.9999/kwin/effects/presentwindows/presentwindows_proxy.cpp:39
#9  0x00007f717d92394c in KWin::DesktopGridEffect::setup (this=this@entry=0x1bfd8c0) at /var/tmp/portage/kde-base/kwin-4.11.49.9999/work/kwin-4.11.49.9999/kwin/effects/desktopgrid/desktopgrid.cpp:1109
#10 0x00007f717d9259c2 in KWin::DesktopGridEffect::setActive (this=0x1bfd8c0, active=<optimized out>) at /var/tmp/portage/kde-base/kwin-4.11.49.9999/work/kwin-4.11.49.9999/kwin/effects/desktopgrid/desktopgrid.cpp:1045
Comment 6 Thomas Lübking 2014-03-21 20:58:59 UTC
Created attachment 85675 [details]
possible patch

The desktopgrid is not robust against screen count changes *while* being up, but i could not cause issues when activating *after* the screen count being changed.
Could be a delayed change?

Attached is a "hotfix" (it's not absolutely perfect but should not eat kittens either) - it would be great if you could try it against your scenario?
Comment 7 Thomas Lübking 2014-04-24 11:20:55 UTC
Git commit 4fe7460e03f5cd4f64d85d20a6d85ce3a66f4ae8 by Thomas Lübking.
Committed on 26/03/2014 at 17:03.
Pushed by luebking into branch 'KDE/4.11'.

setup desktopgrid for screencount change

prevents segfaults..
REVIEW: 117067

M  +10   -3    kwin/effects/desktopgrid/desktopgrid.cpp
M  +1    -1    kwin/effects/desktopgrid/desktopgrid.h

http://commits.kde.org/kde-workspace/4fe7460e03f5cd4f64d85d20a6d85ce3a66f4ae8
Comment 8 Thomas Lübking 2014-04-30 12:17:33 UTC
*** Bug 333920 has been marked as a duplicate of this bug. ***
Comment 9 Martin Flöser 2014-06-04 14:40:47 UTC
Git commit 17ca566154321eb6d81204a8cd54429a6725ed92 by Martin Gräßlin, on behalf of Thomas Lübking.
Committed on 26/03/2014 at 17:03.
Pushed by graesslin into branch 'master'.

setup desktopgrid for screencount change

prevents segfaults..

Forward port of 4fe7460e03f5cd4f64d85d20a6d85ce3a66f4ae8 from kde-workspace

M  +8    -3    effects/desktopgrid/desktopgrid.cpp

http://commits.kde.org/kwin/17ca566154321eb6d81204a8cd54429a6725ed92
Comment 10 Thomas Lübking 2015-09-14 20:07:23 UTC
Git commit 57f8c6d5f88cfb05945d8a2837ed0cec3218e2f9 by Thomas Lübking.
Committed on 14/09/2015 at 19:01.
Pushed by luebking into branch 'Plasma/5.4'.

recreate presentwindows grids from desktopgrid

Theory:
----------
because PresentWindowsEffect::screenCountChanged() is shortcut
for "if (!isActive())", but the desktopgrid doesn't call
PresentWindowsEffect::setActive (or at least
PresentWindowsEffect::screenCountChanged), so the effect can
"miss" the increasing screen count change (it sees the signal,
but ignores it) and when desktopgrid calls it, it assumes the
m_gridSizes array is big enough (but it isn't)

Steps:
----------
1. effects are loaded, 1 screen present
2. 2nd screen gets added, but inactive effects ignore that
3. desktop grid gets activated, updates according to screen count,
   calls presentwindows for screen #2
4. presentwindows data is only prepared for one screen from step 1
   => BOOM
Related: bug 351724
FIXED-IN: 5.4.2
REVIEW: 124960

M  +1    -0    effects/desktopgrid/desktopgrid.cpp
M  +8    -5    effects/presentwindows/presentwindows.cpp
M  +1    -1    effects/presentwindows/presentwindows.h
M  +5    -0    effects/presentwindows/presentwindows_proxy.cpp
M  +2    -0    effects/presentwindows/presentwindows_proxy.h

http://commits.kde.org/kwin/57f8c6d5f88cfb05945d8a2837ed0cec3218e2f9