OmniCC

OmniCC

54M Downloads

Wierd behavior when parent frame is shown after cooldown is set.

abija opened this issue ยท 4 comments

commented

Sometimes when parent frame is shown after the cooldown is modified, OmniCC doesn't display the text.

Considering the following code:
local f = CreateFrame("Frame", nil, UIParent)
f:Hide()
f:SetSize(100, 100)
f:SetPoint("CENTER", 0, 0)
local t = f:CreateTexture()
t:SetAllPoints()
t:SetTexture(GetSpellTexture("Thunderstorm"))
t = CreateFrame("Cooldown", "clctesttimer", f)
t:SetSize(100, 100)
t:SetPoint("CENTER")
f:Show()
CooldownFrame_SetTimer(t, GetSpellCooldown("Thunderstorm"))
If f:Show() is after CooldownFrame_SetTimer, on reloadui while the cooldown is active, sometimes the cooldown text isn't displayed.

The wierd part is that the only difference I noticed between the two situations seems to be due to multithreading issues in Timer:UpdateText(forceStyleUpdate).
The "timeline" when the text isn't displayed would like this:

1 UpdateText is called from UpdateShown
1 ScheduleUpdate is called from UpdateText
1 enter ScheduleUpdate
2 UpdateText is called from cooldown_OnSizeChanged
2 ScheduleUpdate is called from UpdateText
2 enter ScheduleUpdate
2 exit ScheduleUpdate
2 exit UpdateText
1 exit ScheduleUpdate
1 exit UpdateText

commented

I just made a small tweak to the development version. It may or may not fix the problem.

commented

Seems to be working fine after that change.
There is some weird behavior with finishing effects though (not sure if from last build since I didn't test it before).

There are 2 small issues, not sure first one is a bug, second one certainly isn't but it's annoying.

First issue:
If you have CooldownFrame_SetTimer(t, 0, 0, 1) before CooldownFrame_SetTimer(t, 1000, 10, 1), you will get a finishing effect when the 10s cooldown animation starts.

Second issue:
Due to the fact that the finishing effects are played after the cooldown ends and not just before, you can't reliably chain cooldowns on the same icon.
For example, let's say you want to display on an icon archangel buff, and when it expires the cooldown on archangel ability. If you update the icon fast the finishing effect from the buff timer will be canceled when the new cooldown is displayed.

commented

These issues may or may not be fixed in waffles7

commented

Closing this for now. Let me know if the issue reappears :)