nyyr / ArcHUD3

WoW Addon: Smooth combat HUD based on ArcHUD2
GNU General Public License v2.0
5 stars 10 forks source link

ArcHUD3-Classic Taints global API function UnitAura #45

Closed DDCorkum closed 5 years ago

DDCorkum commented 5 years ago

Issue: ArcHud3 overwrites the global API function UnitAura at line 11 of Interface\AddOns\ArcHUD3-classic\Rings\CustomBuff.lua, making it impossible to right-click on a buff during combat (which normally should remove it) and causing mayhem for other addons with secure unit frames.

Background: This section of code appears intended to wrap UnitAura() during classic, possibly to accomodate the ratail/classic differences. However, it ovewrites the global rather than a local instance. There is an easy fix at the bottom of this post.

Steps to Reproduce: Enter combat, and right click on a buff. Notice that it won't go away.

Workaround: There is no workaround for the loss of right-clicking on buffs, because that feature requires a taint-free (ie, properly functioning) UnitAura() global. Meanwhile, other competing addons must offer insecure alternatives that can provide "view only" information without the convenience of intractability during combat.

Problematic Source Code: if ArcHUD.classic then LibClassicDurations = LibStub("LibClassicDurations", true) LibClassicDurations:Register("ArcHUD_CustomBuffModule") UnitAura = LibClassicDurations.UnitAuraWrapper end

Recommendation: I believe you were only intending to overwrite UnitAura during this single file, so you can fix the problem with the following:

local UnitAura = UnitAura; if ArcHUD.classic then LibClassicDurations = LibStub("LibClassicDurations", true) LibClassicDurations:Register("ArcHUD_CustomBuffModule") UnitAura = LibClassicDurations.UnitAuraWrapper end

This will make UnitAura a local variable that refers to the global one on retail, or to the custom wrapper on classic. The scope will only affect this single file. I have already concluded that this solves the problem with Blizzard default frames, and also at least one other popular addon.

DDCorkum commented 5 years ago

Upon further investigation, this single line of code solves two issues. I have linked #44 to this one.

DDCorkum commented 5 years ago

I just realized: this is Git, I can make the change for you. I've created a fork and added the correction to the file. It is now waiting for your approval in the Pull Requests queue

nyyr commented 5 years ago

Oops, thanks a lot