Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADDON_ACTION_FORBIDDEN #25

Open
kriminy opened this issue Jun 13, 2023 · 6 comments
Open

ADDON_ACTION_FORBIDDEN #25

kriminy opened this issue Jun 13, 2023 · 6 comments

Comments

@kriminy
Copy link

kriminy commented Jun 13, 2023

WoW Classic Era client version 1.14.3
Unitscan version 1.1.2

When unitscan detects a unit in the target list, it triggers a Lua error with a warning pop-up from the game client.

The warning from the game client is as follows:

unitscan has been blocked from an action only available to the Blizzard UI. You can disable this addon and reload the UI.

It has clickable buttons to "Disable" or "Ignore."

As long as the unit is in render range, the client error message will instantly reappear when "Ignore" is clicked. The client and addon otherwise run normally except that all other actions that require interaction with a client dialogue box cannot be performed (Accepting a group invitation, abandoning pet, etc).

The Lua error message is as follows:

[ADDON_ACTION_FORBIDDEN] AddOn 'unitscan' tried to call the protected function 'TargetUnit()'.
[string "=[C]"]: in function TargetUnit' [string "@Interface\AddOns\unitscan\unitscan-v1.1.2.lua"]:42: in function target'
[string "@interface\AddOns\unitscan\unitscan-v1.1.2.lua"]:273: in function `UPDATE'
[string "@interface\AddOns\unitscan\unitscan-v1.1.2.lua"]:3: in function <Interface\AddOns\unitscan\unitscan.lua:3>

I have not always been able to reproduce this issue. It seems that reloading the UI stops the error.

@desmondw
Copy link

desmondw commented Jul 6, 2023

This has also started happening to me now after the latest update from Unitscan version 1.1.3, however I am on WoW Classic Era 1.14.2. Maybe a fix for this issue on the PTR has made it reoccur for non-PTR?

@kriminy
Copy link
Author

kriminy commented Jul 7, 2023

This has also started happening to me now after the latest update from Unitscan version 1.1.3, however I am on WoW Classic Era 1.14.2. Maybe a fix for this issue on the PTR has made it reoccur for non-PTR?

This bug was reported before the PTR was accessible. Classic Era live servers are on TOC version 1.14.3. The PTR is on TOC version 1.14.4. There aren't any official servers running TOC version 1.14.2.

Just to be clear, this bug exists on both the PTR and live servers. It was reported on live servers in the previous version (unitscan 1.1.2), and continues to exist on both the PTR and live servers in the new version (unitscan 1.1.3).

As a workaround, I've found that reloading the UI usually seems to clear the error dialogue. Also, using the add-ons BugSack and BugGrabber (have to use both together) catch the error and prevent it from popping up the annoying dialogue box.

This bug seems to be completely unrelated to the bug that was causing the massive slowdown on the PTR.

@shirsig
Copy link
Owner

shirsig commented Jul 8, 2023

I don't think this has anything to do with client version or unitscan version changes. This issue has always been due to conflicts with other addons. The error cannot be prevented because triggering the error is the detection mechanism. Unitscan overrides the error handler in the default UI so the error isn't visible, but it cannot prevent other addons from potentially showing the error.

@Dwarni
Copy link

Dwarni commented Sep 10, 2023

I've found out that RareScanner caused this problem. After disabling RareScanner Unitscanner works fine without getting this error message.

EDIT: Error still occurs don't know why it disappeared for some time...

@desmondw
Copy link

What @shirsig said is correct. I personally identified my issue being caused by Nova World Buffs:

function NWB:scanTicker()
	if (not doScan or not NWB.db.global.earlyRendScan) then
		return;
	end
	local _, _, zone = NWB.dragonLib:GetPlayerZonePosition();
	if (LOCALE_enUS or LOCALE_enGB) then
		if (zone ~= 1413 or GetSubZoneText() ~= POSTMASTER_LETTER_BARRENS_MYTHIC) then
			NWB:debug("Scan zone error.");
			NWB:disableScan();
		end
	else
		if (zone ~= 1413) then
			NWB:debug("Scan zone error.");
			NWB:disableScan();
		end
	end
	--Only enabled during this short window so it doesn't clash with other scan addons.
	scanCheckEnabled = true;
	UIParent:UnregisterEvent("ADDON_ACTION_FORBIDDEN");
	scanFrame:RegisterEvent("ADDON_ACTION_FORBIDDEN");
	TargetUnit(L["Herald of Thrall"], true);
	scanFrame:UnregisterEvent("ADDON_ACTION_FORBIDDEN");
	UIParent:RegisterEvent("ADDON_ACTION_FORBIDDEN");
	scanCheckEnabled = false;
	C_Timer.After(1, function()
		NWB:scanTicker();
	end)
end

The offending code is UIParent:RegisterEvent("ADDON_ACTION_FORBIDDEN");.
Ironically the comment says they're trying to avoid clashing with other addons, but since unitscan's method is unconventional their code does indeed cause a conflict.

Would it be possible to just unregister the event again in unitscan?

@shirsig
Copy link
Owner

shirsig commented Sep 12, 2023

I made a fix for addons that reenable the event on UIParent.
This doesn't help for addons that use their own frames, however. For some reason I was under the impression that EnumerateFrames only works for named frames, but that doesn't seem to be the case, so I might actually be able to make a generic fix, something like this:

do
	local f
	CreateFrame'Frame':SetScript('OnUpdate', function()
		f = EnumerateFrames(f)
		if f and f:IsEventRegistered'ADDON_ACTION_FORBIDDEN' then
			f:UnregisterEvent'ADDON_ACTION_FORBIDDEN'
		end
	end)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants