Bug 200213

Summary: kwin crashed when I applied the "Center" change for "Title Alignment"
Product: [Plasma] kwin Reporter: Craig Magina <Craig.Magina>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: balcaen.john, bighairyandy, cfeck, Ekkehard.Blanz, johannesobermayr, jonne.borgman, larzuf, leandrosansilva, linuxg33k4life, mail, martin.tlustos, sberkow, steve.doc.brown, volodya
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: New crash information added by DrKonqi

Description Craig Magina 2009-07-14 20:08:27 UTC
Application that crashed: kwin
Version of the application: 4.2.96 (KDE 4.2.96 (KDE 4.3 RC2))
KDE Version: 4.2.96 (KDE 4.2.96 (KDE 4.3 RC2))
Qt Version: 4.5.2
Operating System: Linux 2.6.30-8-generic x86_64
Distribution: Ubuntu karmic (development branch)

What I was doing when the application crashed:
kwin crashed when I applied the "Center" change for "Title Alignment" is exactly what I was doing at the time.  My system is running a dual monitor, ATi setup using the open source ATi driver and a custom Xinerama enabled xorg.conf.

 -- Backtrace:
Application: KWin (kwin), signal: Segmentation fault
[KCrash Handler]
#5  QBasicAtomicInt::ref (this=0x7f8aec001220, desktop=8, areas=) at /usr/include/qt4/QtCore/qatomic_x86_64.h:121
#6  QVector (this=0x7f8aec001220, desktop=8, areas=) at /usr/include/qt4/QtCore/qvector.h:113
#7  QForeachContainer (this=0x7f8aec001220, desktop=8, areas=) at /usr/include/qt4/QtCore/qglobal.h:2054
#8  KWin::Workspace::previousRestrictedMoveArea (this=0x7f8aec001220, desktop=8, areas=) at ../../kwin/geometry.cpp:327
#9  0x00007f8b002e1a2a in KWin::Client::checkWorkspacePosition (this=0x1e0ee60) at ../../kwin/geometry.cpp:1134
#10 0x00007f8b00299ac4 in KWin::Client::updateDecoration (this=0x1e0ee60, check_workspace_pos=true, force=<value optimized out>) at ../../kwin/client.cpp:348
#11 0x00007f8b0028e7e7 in KWin::Workspace::slotReconfigure (this=0x7f8aec001220) at ../../kwin/workspace.cpp:1055
#12 0x00007f8b0028f79c in KWin::Workspace::qt_metacall (this=0x7f8aec001220, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffcdd4ff00) at ./workspace.moc:443
#13 0x00007f8afc2a2e1c in QMetaObject::activate (sender=0x7f8aec0014d8, from_signal_index=<value optimized out>, to_signal_index=<value optimized out>, argv=0x7fffcdd4fd00) at kernel/qobject.cpp:3113
#14 0x00007f8afc29cdc3 in QObject::event (this=0x7f8aec0014d8, e=0x7f8aec001220) at kernel/qobject.cpp:1075
#15 0x00007f8afc99162c in QApplicationPrivate::notify_helper (this=0x19d0430, receiver=0x7f8aec0014d8, e=0x7fffcdd50500) at kernel/qapplication.cpp:4056
#16 0x00007f8afc9988fe in QApplication::notify (this=0x7fffcdd50860, receiver=0x7f8aec0014d8, e=0x7fffcdd50500) at kernel/qapplication.cpp:4021
#17 0x00007f8affaf43f6 in KApplication::notify (this=0x7fffcdd50860, receiver=0x7f8aec0014d8, event=0x7fffcdd50500) at ../../kdeui/kernel/kapplication.cpp:302
#18 0x00007f8afc28dc6c in QCoreApplication::notifyInternal (this=0x7fffcdd50860, receiver=0x7f8aec0014d8, event=0x7fffcdd50500) at kernel/qcoreapplication.cpp:610
#19 0x00007f8afc2b8912 in QCoreApplication::sendEvent (this=0x19d4150) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#20 QTimerInfoList::activateTimers (this=0x19d4150) at kernel/qeventdispatcher_unix.cpp:572
#21 0x00007f8afc2b62ad in timerSourceDispatch (source=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:165
#22 0x00007f8af6c639fe in g_main_dispatch (context=0x19d2df0) at /build/buildd/glib2.0-2.21.3/glib/gmain.c:1960
#23 IA__g_main_context_dispatch (context=0x19d2df0) at /build/buildd/glib2.0-2.21.3/glib/gmain.c:2513
#24 0x00007f8af6c673c8 in g_main_context_iterate (context=0x19d2df0, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>)
    at /build/buildd/glib2.0-2.21.3/glib/gmain.c:2591
#25 0x00007f8af6c674f0 in IA__g_main_context_iteration (context=0x19d2df0, may_block=1) at /build/buildd/glib2.0-2.21.3/glib/gmain.c:2654
#26 0x00007f8afc2b61f6 in QEventDispatcherGlib::processEvents (this=0x19b6cc0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:327
#27 0x00007f8afca25ace in QGuiEventDispatcherGlib::processEvents (this=0x7fffcdd4fc60, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:202
#28 0x00007f8afc28c572 in QEventLoop::processEvents (this=<value optimized out>, flags=) at kernel/qeventloop.cpp:149
#29 0x00007f8afc28c944 in QEventLoop::exec (this=0x7fffcdd507a0, flags=) at kernel/qeventloop.cpp:201
#30 0x00007f8afc28eaf9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#31 0x00007f8b002a6054 in kdemain (argc=<value optimized out>, argv=<value optimized out>) at ../../kwin/main.cpp:527
#32 0x00007f8afff0d5e6 in __libc_start_main (main=0x400720 <main>, argc=1, ubp_av=0x7fffcdd50d48, init=0x400750 <__libc_csu_init>, fini=<value optimized out>, rtld_fini=<value optimized out>, 
    stack_end=0x7fffcdd50d38) at libc-start.c:220
#33 0x0000000000400659 in _start () at ../sysdeps/x86_64/elf/start.S:113

Reported using DrKonqi
Comment 1 Martin Flöser 2009-07-14 20:15:35 UTC
What window decoration are you using? That might be an important information for reproducing
Comment 2 Craig Magina 2009-07-14 20:29:02 UTC
Kubuntu's default, which is Ozone.
Comment 3 Martin Flöser 2009-07-17 22:08:41 UTC
cannot reproduce neither in RC2 nor in trunk
Comment 4 Martin Flöser 2009-09-06 15:42:23 UTC
*** Bug 202572 has been marked as a duplicate of this bug. ***
Comment 5 Martin Flöser 2009-12-06 15:42:38 UTC
*** Bug 211439 has been marked as a duplicate of this bug. ***
Comment 6 Johannes Obermayr 2009-12-19 00:20:40 UTC
Martin told me that it could be an upstream Qt bug:

http://bugreports.qt.nokia.com/browse/QTBUG-6934
Comment 7 Thomas Lübking 2009-12-20 02:59:03 UTC
SVN commit 1064056 by luebking:

avoid "deep" QVector copy

CCBUG: 217040


 M  +1 -1      geometry.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1064056
Comment 8 Johannes Obermayr 2009-12-24 15:29:52 UTC
KWin does not crash on my system with KDE 4.3.85 and Qt 4.6.0_20091222 anymore.
Comment 9 Dario Andres 2009-12-31 14:41:58 UTC
*** Bug 220775 has been marked as a duplicate of this bug. ***
Comment 10 Martin Flöser 2010-03-31 12:33:44 UTC
seems to be fixed
Comment 11 Thomas Lübking 2010-05-16 15:53:09 UTC
*** Bug 237816 has been marked as a duplicate of this bug. ***
Comment 12 Thomas Lübking 2010-05-16 15:54:11 UTC
reopening.

actually "foreach" creates an implicitly shared copy despite the return is a
reference... so to bypass this bug we'd have to replace "foreach" by eg. an stl
run
Comment 13 Thomas Lübking 2010-08-03 17:17:44 UTC
*** Bug 246619 has been marked as a duplicate of this bug. ***
Comment 14 Thomas Lübking 2010-08-08 18:54:23 UTC
*** Bug 247080 has been marked as a duplicate of this bug. ***
Comment 15 Thomas Lübking 2010-09-12 17:14:41 UTC
*** Bug 250984 has been marked as a duplicate of this bug. ***
Comment 16 Andrew GT Potter 2010-10-06 11:57:32 UTC
Created attachment 52264 [details]
New crash information added by DrKonqi

Kwin crashed while changing the theme for the window borders.
Comment 17 Thomas Lübking 2010-12-06 16:01:06 UTC
*** Bug 258964 has been marked as a duplicate of this bug. ***
Comment 18 Thomas Lübking 2011-02-14 16:25:13 UTC
*** Bug 266300 has been marked as a duplicate of this bug. ***
Comment 19 Christoph Feck 2011-03-07 00:07:13 UTC
I am reopening this bug as was probably intended with comment #12. We get this bug with KDE 4.6.0 / Qt 4.7.0, too (see bug 266300), so it is not fixed. The upstream "bug" mentioned in comment #6 is not even confirmed, and I doubt it is a Qt bug.
Comment 20 Thomas Lübking 2011-03-07 00:08:57 UTC
*** Bug 267839 has been marked as a duplicate of this bug. ***
Comment 21 Thomas Lübking 2011-03-07 00:25:58 UTC
workspace.cpp:1641 void Workspace::setNumberOfDesktops(int n) is now also called by the desktopgrid effect (and not only through loadDesktopSettings()
so it desperately lacks
    workarea.clear();
    workarea.resize(n + 1);
    restrictedmovearea.clear();
    restrictedmovearea.resize(n + 1);
    oldrestrictedmovearea.clear();
    oldrestrictedmovearea.resize(n + 1);
after 
  desktopCount_ = n;

just like loadDesktopSettings() - or we just move that entirely there....

w/o any testing i'm selfconfident enough to mark this as new - blame immediate music ;-P
Comment 22 Thomas Lübking 2011-03-17 03:00:08 UTC
*** Bug 268711 has been marked as a duplicate of this bug. ***
Comment 23 Thomas Lübking 2011-04-03 22:46:15 UTC
Git commit 40b1f456da80ff24223920749128b742280506bb by Thomas Lübking.
Committed on 07/03/2011 at 18:41.
Pushed by luebking into branch 'master'.

fix & cleanup Workspace::setNumberOfDesktops()

encapsulate all relevant (vector resizing) code to
Workspace::setNumberOfDesktops and invoke it from
Workspace::loadDesktopSettigns, this will likely
fix
CCBUG:200213

M  +25   -42   kwin/workspace.cpp     

http://commits.kde.org/kde-workspace/40b1f456da80ff24223920749128b742280506bb
Comment 24 Thomas Lübking 2011-04-13 22:55:28 UTC
Git commit f3f255fef1be7d36c0a6fb931a46f52178440cb3 by Thomas Lübking.
Committed on 13/04/2011 at 22:58.
Pushed by luebking into branch 'KDE/4.6'.

fix & cleanup Workspace::setNumberOfDesktops()

CCBUG: 200213

M  +24   -36   kwin/workspace.cpp     

http://commits.kde.org/kde-workspace/f3f255fef1be7d36c0a6fb931a46f52178440cb3
Comment 25 Balcaen John 2011-04-18 02:37:09 UTC
(In reply to comment #24)
> Git commit f3f255fef1be7d36c0a6fb931a46f52178440cb3 by Thomas Lübking.
> Committed on 13/04/2011 at 22:58.
> Pushed by luebking into branch 'KDE/4.6'.
> 
> fix & cleanup Workspace::setNumberOfDesktops()
> 
> CCBUG: 200213
> 
> M  +24   -36   kwin/workspace.cpp     
> 
> http://commits.kde.org/kde-workspace/f3f255fef1be7d36c0a6fb931a46f52178440cb3

When building kdebase4-workspace with this patch included (which will be so in 4.6.3) the number of virtual desktop available in the pager applet  (& in kcmshell4 desktop) are reduced to 1 & the  creation of new virtual desktop is not working as expected :
For example if i'm trying to increase the number of virtual desktop from 1 to 6 using kcmshell4 desktop  ,i don't see any creation in the pager applet after.
Maybe the pager applet need some changes too ?

Regards,
Comment 26 Thomas Lübking 2011-04-18 10:59:22 UTC
Yes, known - but thanks.

The backport isn't "complete" compared to the master version (because i didn't want to change sth. that seemed wrong but harmless) - turned out to cause a functional lack on initial startup.
(if you run the desktopgrid effect and add, then remove a desktop the state will be validated)

The change will be committed later this day. Sorry for trouble.
Comment 27 Thomas Lübking 2011-04-18 21:13:23 UTC
Git commit 79187a9feb1ae0a0c5f49b7669a65b3606271ea1 by Thomas Lübking.
Committed on 18/04/2011 at 21:16.
Pushed by luebking into branch 'KDE/4.6'.

complete backport for setNumberOfDesktops() fix

CCBUG: 200213
completes backport f3f255fef1be7d36c0a6fb931a46f52178440cb3 to match
master version 40b1f456da80ff24223920749128b742280506bb since the
incomplete backport lead to unset number of desktops on the root window
(applies only after relogin)

M  +6    -9    kwin/workspace.cpp     

http://commits.kde.org/kde-workspace/79187a9feb1ae0a0c5f49b7669a65b3606271ea1
Comment 28 Martin Flöser 2011-05-07 13:11:22 UTC
is this one fixed?
Comment 29 Thomas Lübking 2011-05-07 13:27:47 UTC
"likely" - the CC was intentional since i could not reproduce this crash (compiler aggression thing?!)
The altered code however was prone to invalidate the vector, causing out-of-bound access - it nevertheless could still be a Qt bug - or a combination of both ;-)

For the general bugzilla untrashing, I'll just mark it fixed - and wait for new occurrences... (with new traces)