Bagnon

Bagnon

126M Downloads

Bagnon explicitly taints many bag-related functions

rowaasr13 opened this issue ยท 3 comments

commented

:StopIf method used by :HookBaseUI explicitly overwrites many bags and bank related functions. It's a gross breach of secure code, as they're called in many places in Blizzard's addons and continue to spread taint all over.

For example all anima deposit bugs (#1602, #1593, #1357, #1347) are directly related to this, and likely many other taint bugs as well.
Commenting hook out like

--		domain[name] = function(...)
--			if not hook(...) then
--				return original(...)
--			end
--		end

makes deposit work once again.

Please NEVER EVER overwrite Blizzard functions - you're guaranteed to spread taint this way. Use hooksecurefunc to post-hook and undo whatever Blizzard function did instead. So for example for OpenAllBags let it run its course and then hide Blizzard frames and open your own in post-hook, etc.

commented

In this particular case the the culprit is overwriting of PlayerInteractionFrameManager.ShowFrame. It gets called with type 51 when Covenant frame is displayed and taints creation of everything including deposit button. Replacing it with post-hook like this one fixes deposting (note two TODOs):

	hooksecurefunc(PlayerInteractionFrameManager, 'ShowFrame', function(manager, type)
		if type == Interactions.Banker then
			if BankFrame then CloseBankFrame() end
			Addon.Frames:Show('bank')
		elseif type == Interactions.GuildBanker then
			-- TODO: hide blizzard
			Addon.Frames:Show('guild')
		elseif type == Interactions.VoidStorageBanker then
			-- TODO: hide blizzard
			Addon.Frames:Show('vault')
		end
	end)
commented

Awesome rundown of the issue! Since my last post mentioned by OP i've had taint issues every now and then, cant click items from bag, cant click items from quests in the questpane and others.
Hope dev finally takes a hard look at this specially with this splendid breakdown of what's causing them.

commented

I've added function to neutralize I events/hook I could remember on Blizzard frames so final change is like this:

	local function NeutralizeFrame(frame)
		if not frame then return end
		frame:UnregisterAllEvents()
		frame:SetScript("OnEvent", nil)
		frame:SetScript("OnShow", nil)
		frame:SetScript("OnHide", nil)
		HideUIPanel(frame)
		frame:ClearAllPoints()
		frame:Hide()
	end

	hooksecurefunc(PlayerInteractionFrameManager, 'ShowFrame', function(manager, type)
		if type == Interactions.Banker then
			NeutralizeFrame(BankFrame)
			NeutralizeFrame(ReagentBankFrame)
			Addon.Frames:Show('bank')
		elseif type == Interactions.GuildBanker then
			Addon.Frames:Show('guild')
		elseif type == Interactions.VoidStorageBanker then
			Addon.Frames:Show('vault')
		end
	end)