Thread Tools Display Modes
06-08-16, 06:28 AM   #1
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
GarrisonMissionListButtonTemplate button -> replace OnClick = ADDON_ACTION_FORBIDDEN

Code: (click on a mission and press escape twice to close mission + main frame to get the error)

Lua Code:
  1. local GarrisonMissionButton_OnClickHook = function(self, button)
  2.     GarrisonMissionButton_OnClick(self, button);
  3. end
  4.  
  5. local GarrisonMissionList_UpdateHook = function(self)
  6.     local availableMissionsTabShown = not OrderHallMissionFrame.MissionTab.MissionList.showInProgress;
  7.     local missions = availableMissionsTabShown and OrderHallMissionFrame.MissionTab.MissionList.availableMissions or OrderHallMissionFrame.MissionTab.MissionList.inProgressMissions;
  8.     local numMissions = #missions;
  9.  
  10.     if (numMissions > 0) then
  11.         local scrollFrame = OrderHallMissionFrame.MissionTab.MissionList.listScroll;
  12.         local buttons = scrollFrame.buttons;
  13.         local offset = HybridScrollFrame_GetOffset(scrollFrame);
  14.         local numButtons = #buttons;
  15.  
  16.         for i = 1, numButtons do
  17.             local button = buttons[i];
  18.             local index = offset + i;
  19.  
  20.             if (index <= numMissions) then
  21.                 local mission = missions[i + offset];
  22.                 if (not button.hooked) then
  23.                     button:RegisterForClicks("LeftButtonUp", "RightButtonUp");
  24.                     button:SetScript("OnClick", GarrisonMissionButton_OnClickHook);
  25.                     button.hooked = true;
  26.                 end
  27.             end
  28.         end
  29.     end
  30. end
  31.  
  32. local f = CreateFrame("Frame");
  33. f:RegisterEvent("ADDON_LOADED");
  34. f:SetScript("OnEvent", function(self, event, addon)
  35.     if (addon == "Blizzard_OrderHallUI") then
  36.         hooksecurefunc(OrderHallMissionFrame.MissionTab.MissionList, "Update", GarrisonMissionList_UpdateHook);
  37.         self:UnregisterEvent(event);
  38.     end
  39. end);

Error:

Code:
Message: ADDON_ACTION_FORBIDDEN: OrderHallTaint tried to call the protected function 'SpellStopCasting()'.
Time: 06/08/16 13:30:59
Count: 1
Stack: [C]: in function `SpellStopCasting'
Interface\FrameXML\UIParent.lua:3660: in function `ToggleGameMenu'
[string "TOGGLEGAMEMENU"]:1: in function <[string "TOGGLEGAMEMENU"]:1>

Locals: <none>
Any idea why this is happening or how to workaround this? It works fine at WoD garrisons in Legion (and of couse in WoD).
The reason why I'm replacing OnClick is to handle RightButtonUp (GarrisonMissionButton_OnClick doesn't care about button).

I'm not getting the error when removing SpellStopCasting() and SpellStopTargeting() from ToggleGameMenu() (or when moving securecall("CloseAllWindows") up 2 lines) and UnitCastingInfo("player") returns nil.

PS: @Dolby: This cloudflare protection is so annoying, it shows up *everytime* before previewing this post.
 
06-08-16, 08:05 AM   #2
elcius
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Sep 2011
Posts: 75
you can't just call GarrisonMissionButton_OnClick, if you want to hook the click handler, use button:HookScript('OnClick',function() .. end)
 
06-08-16, 08:10 AM   #3
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
I have had a lot of these errors myself while hooking stuff at the orderhall ui. The (basicly) same function work at the garrison ui without any error.
Going to the orderhall and typing /run OrderHallMissionFrame:MissionCompleteInitialize() will get the same taint as you posted, whilst at the agrrison
/run GarrisonMissionFrame:MissionCompleteInitialize() wont get any taint error. I also noticed that OrderHallMissionFrame.MissionPage,"EscapePressed" will easily cause taint :/
To me it almost seems like it puts the palyer in a state comparable to an incombat state and thus causing.
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
 
06-08-16, 10:41 AM   #4
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by elcius View Post
you can't just call GarrisonMissionButton_OnClick, if you want to hook the click handler, use button:HookScript('OnClick',function() .. end)
I don't want to hook it because Blizzard doesn't check for LeftButton and I don't want to show mission details when clicking a mission with the right mouse button.

But I did another test by adding a frame on top of the button that catches the clicks (so the mission button's OnClick handler doesn't get executed) and I still get the error, even if my OnClick handler is as simple as this (and basically does nothing, it only sets isZoneSupport, just like Blizzard does in OrderHallMission.OnClickMission):

Lua Code:
  1. local missionButton = self:GetParent();
  2. local missionFrame = missionButton:GetParent():GetParent():GetParent():GetParent():GetParent();
  3. local missionInfo = missionButton.info;
  4. missionFrame.MissionTab.isZoneSupport = missionInfo.isZoneSupport;

This is easily reproducable without any addons by clicking a mission, executing
Lua Code:
  1. /run OrderHallMissionFrame.MissionTab.isZoneSupport = OrderHallMissionFrame.MissionTab.isZoneSupport;
and pressing escape twice.

 
06-14-16, 11:34 PM   #5
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
seems fixed now
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » GarrisonMissionListButtonTemplate button -> replace OnClick = ADDON_ACTION_FORBIDDEN

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off