Quantcast
SetAttribute protected error - WoWInterface
Thread Tools Display Modes
03-27-14, 06:18 AM   #1
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
SetAttribute protected error

Hello again

I have the following portion of code:

Lua Code:
  1. local MaxGroup = CreateFrame("Frame", "SanUIRaidMaxGroup")
  2.         MaxGroup:RegisterEvent("PLAYER_ENTERING_WORLD")
  3.         MaxGroup:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  4.         MaxGroup:SetScript("OnEvent", function(self)
  5.             local filter
  6.             local inInstance, instanceType = IsInInstance()
  7.             local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo()
  8.            
  9.             if maxPlayers == 25 then
  10.                 filter = twentyfive
  11.             elseif maxPlayers == 10 then
  12.                 filter = ten
  13.             else
  14.                 filter = forty
  15.             end
  16.  
  17.             if inInstance and instanceType == "raid" then
  18.                 SanUIRaid:SetAttribute("groupFilter", filter)
  19.                 if C.unitframes.showraidpets then
  20.                     SanUIRaidPets:SetAttribute("groupFilter", filter)
  21.                 end
  22.             else
  23.                 SanUIRaid:SetAttribute("groupFilter", "1,2,3,4,5,6,7,8")
  24.                 if C.unitframes.showraidpets then
  25.                     SanUIRaidPets:SetAttribute("groupFilter", "1,2,3,4,5,6,7,8")
  26.                 end
  27.             end
  28.         end)

SanUIRaid and SanUIRaidPets are the headers for raid/pets. I sometimes get the following errors:

Code:
2x [ADDON_ACTION_BLOCKED] AddOn 'Tukui' hat versucht die geschützte Funktion 'SanUIRaid:SetAttribute()' aufzurufen.
AddOns\!BugGrabber\BugGrabber.lua:581: in function <AddOns\!BugGrabber\BugGrabber.lua:581>
[C]: in function `SetAttribute'
AddOns\SanUI\raidframes.lua:910: in function <AddOns\SanUI\raidframes.lua:891>

Locals:
nil
Code:
2x [ADDON_ACTION_BLOCKED] AddOn 'Tukui' hat versucht die geschützte Funktion 'SanUIRaidPets:SetAttribute()' aufzurufen.
AddOns\!BugGrabber\BugGrabber.lua:581: in function <AddOns\!BugGrabber\BugGrabber.lua:581>
[C]: in function `SetAttribute'
AddOns\SanUI\raidframes.lua:912: in function <AddOns\SanUI\raidframes.lua:891>

Locals:
nil
The error message translates to english as "Addon Tukui tried to call the protected function 'SanUIRaid:SetAttribute()' ", which is a bit strange, since the code does not belong to the addon Tukui (but I use Tukui as a basis and there might be some spawn magic I don't understand; my guess is that this does not really matter). Lines 910 and 912 are the last two SetAttribute calls in the code, but it might be that at other times (i.e. when I'm in a raid) those other 2 calls are the problems. If the full code would be more helpfull, I suggest you download SanUI, the file would be SanUI/raidframes.lua.

The error isn't really reproduceable. A guess would be that this happens at the rare occasions where PLAYER_ENTERING_WORLD or ZONE_CHANGED_NEW_AREA fire while in combat (which isn't easily tested, so I'm not sure).

What's the problem here? Is SetAttribute not useable in combat? I thought that was the point of SetAttribute to let you change table entries you can't access directly... Thanks for any help and pointers!
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
03-27-14, 06:39 AM   #2
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
You can't modify secure frames in combat. You can check for InCombatLockdown() and apply your changes at PLAYER_REGEN_ENABLED though.
  Reply With Quote
03-27-14, 08:32 AM   #3
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Ah ok then, I'll give that a shot. Thanks!
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » SetAttribute protected error

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