Bug 313655 - unloading of "Mouse Click Animation" result in kwin crash
Summary: unloading of "Mouse Click Animation" result in kwin crash
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: 4.10
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-21 23:01 UTC by Dario Cambié
Modified: 2013-01-28 07:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.10
thomas.luebking: ReviewRequest+


Attachments
Quick and dirty patch (1.74 KB, patch)
2013-01-21 23:32 UTC, Dario Cambié
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dario Cambié 2013-01-21 23:01:14 UTC
Application: kwin (4.10.60)
KDE Platform Version: 4.10.60 (Compiled from sources)
Qt Version: 4.8.3
Operating System: Linux 3.5.0-22-generic x86_64
Distribution: Ubuntu 12.10

-- Information about the crash:
- What I was doing when the application crashed:
Pressed Alt+Shift+F12 with Mouse Click Animation enabled makes kwin crash (without it doesn't).

Moreover also disabling the same effect from the kcm and press apply produces similar crash.

The crash can be reproduced every time.

-- Backtrace:
Application: KWin (kwin), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fe22567e7c0 (LWP 2507))]

Thread 4 (Thread 0x7fe20931b700 (LWP 2512)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:215
#1  0x00007fe21fee3fa7 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fe21fed754f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fe21fee3aec in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007fe21fc52e9a in start_thread (arg=0x7fe20931b700) at pthread_create.c:308
#5  0x00007fe224e5acbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fe203fff700 (LWP 2513)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:215
#1  0x00007fe21fee3fa7 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fe21fed754f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fe21fee3aec in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007fe21fc52e9a in start_thread (arg=0x7fe203fff700) at pthread_create.c:308
#5  0x00007fe224e5acbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fe200d01700 (LWP 2520)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fe2214d9cd7 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#2  0x00007fe2214d9d09 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#3  0x00007fe21fc52e9a in start_thread (arg=0x7fe200d01700) at pthread_create.c:308
#4  0x00007fe224e5acbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fe22567e7c0 (LWP 2507)):
[KCrash Handler]
#6  0x00007fe224d9d425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00007fe224da0b8b in __GI_abort () at abort.c:91
#8  0x00007fe224d960ee in __assert_fail_base (fmt=<optimized out>, assertion=0x7fe225257bc5 "mouse_poll_ref_count", file=0x7fe225257828 "/home/kde/kdesrc/kde/kde-workspace/kwin/effects.cpp", line=<optimized out>, function=<optimized out>) at assert.c:94
#9  0x00007fe224d96192 in __GI___assert_fail (assertion=0x7fe225257bc5 "mouse_poll_ref_count", file=0x7fe225257828 "/home/kde/kdesrc/kde/kde-workspace/kwin/effects.cpp", line=589, function=0x7fe225259820 <KWin::EffectsHandlerImpl::stopMousePolling()::__PRETTY_FUNCTION__> "virtual void KWin::EffectsHandlerImpl::stopMousePolling()") at assert.c:103
#10 0x00007fe225205b17 in KWin::EffectsHandlerImpl::stopMousePolling (this=<optimized out>) at /home/kde/kdesrc/kde/kde-workspace/kwin/effects.cpp:589
#11 0x00007fe200e3bfff in KWin::MouseClickEffect::~MouseClickEffect (this=0x128cec0, __in_chrg=<optimized out>) at /home/kde/kdesrc/kde/kde-workspace/kwin/effects/mouseclick/mouseclick.cpp:71
#12 0x00007fe200e3c109 in KWin::MouseClickEffect::~MouseClickEffect (this=0x128cec0, __in_chrg=<optimized out>) at /home/kde/kdesrc/kde/kde-workspace/kwin/effects/mouseclick/mouseclick.cpp:80
#13 0x00007fe225209f46 in KWin::EffectsHandlerImpl::unloadEffect (this=this@entry=0x13f2f20, name=...) at /home/kde/kdesrc/kde/kde-workspace/kwin/effects.cpp:1437
#14 0x00007fe22520a178 in KWin::EffectsHandlerImpl::~EffectsHandlerImpl (this=0x13f2f20, __in_chrg=<optimized out>) at /home/kde/kdesrc/kde/kde-workspace/kwin/effects.cpp:155
#15 0x00007fe22520a249 in KWin::EffectsHandlerImpl::~EffectsHandlerImpl (this=0x13f2f20, __in_chrg=<optimized out>) at /home/kde/kdesrc/kde/kde-workspace/kwin/effects.cpp:159
#16 0x00007fe2251e1c26 in KWin::Compositor::finish (this=0xd377e0) at /home/kde/kdesrc/kde/kde-workspace/kwin/composite.cpp:278
#17 0x00007fe225170f62 in KWin::Workspace::qt_static_metacall (_o=0xd0fc10, _c=<optimized out>, _id=<optimized out>, _a=0x7fff999c2ee0) at /home/kde/kdesrc/build/kde/kde-workspace/kwin/workspace.moc:309
#18 0x00007fe21fff5f5f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#19 0x00007fe21f164a32 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007fe21f164c20 in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#21 0x00007fe224985a21 in trigger (this=0xd7e910) at /usr/include/qt4/QtGui/qaction.h:218
#22 KGlobalAccelPrivate::_k_invokeAction (this=0xd3aa90, componentUnique=..., actionUnique=..., timestamp=29063689) at /home/kde/kdesrc/kde/kdelibs/kdeui/shortcuts/kglobalaccel.cpp:449
#23 0x00007fe21fff5f5f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#24 0x00007fe224a85349 in OrgKdeKglobalaccelComponentInterface::globalShortcutPressed (this=<optimized out>, _t1=..., _t2=..., _t3=29063689) at /home/kde/kdesrc/build/kde/kdelibs/kdeui/kglobalaccel_component_interface.moc:164
#25 0x00007fe224a857b4 in qt_static_metacall (_a=<optimized out>, _id=<optimized out>, _o=<optimized out>, _c=<optimized out>) at /home/kde/kdesrc/build/kde/kdelibs/kdeui/kglobalaccel_component_interface.moc:75
#26 OrgKdeKglobalaccelComponentInterface::qt_static_metacall (_o=0xd3bab0, _c=<optimized out>, _id=<optimized out>, _a=0x7fff999c3440) at /home/kde/kdesrc/build/kde/kdelibs/kdeui/kglobalaccel_component_interface.moc:69
#27 0x00007fe224a85e1f in OrgKdeKglobalaccelComponentInterface::qt_metacall (this=0xd3bab0, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff999c3440) at /home/kde/kdesrc/build/kde/kdelibs/kdeui/kglobalaccel_component_interface.moc:130
#28 0x00007fe22035bed3 in ?? () from /usr/lib/x86_64-linux-gnu/libQtDBus.so.4
#29 0x00007fe21fff543e in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x00007fe21f16ae9c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#31 0x00007fe21f16f30a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#32 0x00007fe224941396 in KApplication::notify (this=0x7fff999c40c0, receiver=0xd3bab0, event=0xe881b0) at /home/kde/kdesrc/kde/kdelibs/kdeui/kernel/kapplication.cpp:311
#33 0x00007fe21ffe056e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#34 0x00007fe21ffe43f1 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#35 0x00007fe21f21089c in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#36 0x00007fe21ffdf2bf in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#37 0x00007fe21ffdf548 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#38 0x00007fe21ffe4708 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#39 0x00007fe22519a454 in kdemain (argc=3, argv=0x7fff999c4208) at /home/kde/kdesrc/kde/kde-workspace/kwin/main.cpp:537
#40 0x00007fe224d8876d in __libc_start_main (main=0x4006a0 <main(int, char**)>, argc=3, ubp_av=0x7fff999c4208, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff999c41f8) at libc-start.c:226
#41 0x00000000004006d1 in _start ()

Possible duplicates by query: bug 311955, bug 309626, bug 308195, bug 303176, bug 301141.

Reported using DrKonqi
Comment 1 Dario Cambié 2013-01-21 23:04:06 UTC
FYI: The same doesn't happen with Track Mouse or Magnifier.
Comment 2 Thomas Lübking 2013-01-21 23:29:03 UTC
if (m_enabled)
   effects->stopMousePolling();
Comment 3 Thomas Lübking 2013-01-21 23:32:01 UTC
https://git.reviewboard.kde.org/r/108536/
Comment 4 Dario Cambié 2013-01-21 23:32:01 UTC
Created attachment 76620 [details]
Quick and dirty patch

The problem could be in
effects->stopMousePolling();
being called whithout a previous
effects->startMousePolling();
(I wasn't using the plugin when crash occurred).

Magnifier seems to use a private variable "polling" to address this problem, so I've copied some code from there and the issue is now gone here.

[disclaimer: I'm by no means a C++ programmer: the attachment is just a try!]
Comment 5 Dario Cambié 2013-01-21 23:33:05 UTC
(Sorry Thomas, I've seen only now your post :D)
Comment 6 Thomas Lübking 2013-01-21 23:35:43 UTC
Nevermind - happens to me all the time (hello mid-air-collision =)
The patch should be ok, but the information is already encoded in m_enabled, so there's no need for another variable (yet actually had considered to propse a Effect::pollMouse(bool) and shortcut that on a flag whether we're already polling (and on destruction autostop - the current way is pretty error prone. proof: this bug)
Comment 7 Thomas Lübking 2013-01-23 21:11:34 UTC
Git commit 809a7fdb63b8659c31e9ffdac41813b0787076dd by Thomas Lübking.
Committed on 22/01/2013 at 00:29.
Pushed by luebking into branch 'KDE/4.10'.

don't stopMousePolling when not started

REVIEW: 108536

M  +2    -1    kwin/effects/mouseclick/mouseclick.cpp

http://commits.kde.org/kde-workspace/809a7fdb63b8659c31e9ffdac41813b0787076dd
Comment 8 Thomas Lübking 2013-01-23 21:12:17 UTC
Git commit aacfda87c5dd6d1ddc91c57c829d19afdbaba8ef by Thomas Lübking.
Committed on 22/01/2013 at 00:29.
Pushed by luebking into branch 'master'.

don't stopMousePolling when not started

REVIEW: 108536

M  +2    -1    kwin/effects/mouseclick/mouseclick.cpp

http://commits.kde.org/kde-workspace/aacfda87c5dd6d1ddc91c57c829d19afdbaba8ef