Bug 360068

Summary: Sometimes two animation ids can be *not* unique
Product: [Plasma] kwin Reporter: Marco Martin <notmart>
Component: scriptingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: cpigat242
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: prints that show the bug

Description Marco Martin 2016-03-04 13:45:18 UTC
since the morphingpopups effect was introduced, every now and then plasma tooltips go flying across the screen right to the top left corner.

debugging the issue, I discovered that's because sometimes different animations can have the same id
Using adresses on the stack as ids, it's possible that if an animation is canceled, then creating immediately after a new one, it will have the same adress, the ids should be globally incremented static longs instead.

Reproducible: Sometimes

Steps to Reproduce:
apply the patch
quickly move the mouse around the taskbar or other plasma tooltips (or possibly other tooltips, like qt applications toolbar tooltips)
every now and then, the tooltip goes flying to 0,0 position

looking at the standard output,  there should be a "MOVE ANIMATION ID:" and "FADE ANIMATION ID:" with the same id
Comment 1 Marco Martin 2016-03-04 13:46:23 UTC
Created attachment 97677 [details]
prints that show the bug

this patch prints out animation ids: it's possible to see the same id popping up multiple times
Comment 2 Marco Martin 2016-03-04 14:12:32 UTC
https://git.reviewboard.kde.org/r/127276/
Comment 3 Marco Martin 2016-03-04 17:19:47 UTC
Git commit 595c5937c9a1e13bdeed2759034ed66d8c89d614 by Marco Martin.
Committed on 04/03/2016 at 17:19.
Pushed by mart into branch 'master'.

use a global static for animation ids

using stack adresses makes it possible (even tough not frequent)
for two animations (onle just killed, one just created) to have
the same id, causing scripts to be potentially really confused.
this replaces the id with a global counter, and the
"flying tooltips" bug is gone.

REVIEW:127276
Related: bug 352254

M  +2    -0    libkwineffects/anidata_p.h
M  +8    -4    libkwineffects/kwinanimationeffect.cpp

http://commits.kde.org/kwin/595c5937c9a1e13bdeed2759034ed66d8c89d614
Comment 4 Martin Flöser 2016-03-23 11:06:15 UTC
Git commit a9fad7396e30a380a27090538e7e66dec6984c52 by Martin Gräßlin, on behalf of Marco Martin.
Committed on 23/03/2016 at 11:03.
Pushed by graesslin into branch 'Plasma/5.6'.

use a global static for animation ids

using stack adresses makes it possible (even tough not frequent)
for two animations (onle just killed, one just created) to have
the same id, causing scripts to be potentially really confused.
this replaces the id with a global counter, and the
"flying tooltips" bug is gone.

REVIEW:127276
Related: bug 352254

M  +2    -0    libkwineffects/anidata_p.h
M  +8    -4    libkwineffects/kwinanimationeffect.cpp

http://commits.kde.org/kwin/a9fad7396e30a380a27090538e7e66dec6984c52