Thread Tools Display Modes
11-11-12, 10:19 PM   #1
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 440
Attempt to find 'this' in non-framescript object?

I'm getting a really funky error with ncHoverBind when attempting to use it with a particular compilation (already notified the person who made it), and wondering if the compatibility issue is with ncHoverBind, or possibly theirs.

I'm well aware that 'this' was removed as a global variable a while back, and ncHoverBind doesn't even use 'this' to begin with.

Here's the error...

Code:
Message: Interface\AddOns\ncHoverBind\ncHoverBind.lua:247: Attempt to find 'this' in non-framescript object
Time: 11/11/12 23:01:33
Count: 4
Stack: [C]: in function `GetObjectType'
Interface\AddOns\ncHoverBind\ncHoverBind.lua:247: in function `register'
Interface\AddOns\ncHoverBind\ncHoverBind.lua:261: in function `?'
Interface\FrameXML\ChatFrame.lua:4358: in function `ChatEdit_ParseText'
Interface\FrameXML\ChatFrame.lua:4052: in function `ChatEdit_SendText'
Interface\FrameXML\ChatFrame.lua:4091: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>

Locals: (*temporary) = <table> {
 1 = <unnamed> {
 }
 2 = <unnamed> {
 }
 3 = <unnamed> {
 }
 4 = <unnamed> {
 }
 0 = <unnamed> {
 }
}
Here's the code blocks containing lines 247 and 260.

(246-257)
Code:
		local function register(val)
			if val.IsProtected and val.GetObjectType and val.GetScript and val:GetObjectType()=="CheckButton" and val:IsProtected() then
				local script = val:GetScript("OnClick")
				if script==button then
					val:HookScript("OnEnter", function(self) bind:Update(self) end)
				elseif script==stance then
					val:HookScript("OnEnter", function(self) bind:Update(self, "STANCE") end)
				elseif script==pet then
					val:HookScript("OnEnter", function(self) bind:Update(self, "PET") end)
				end
			end
		end
(259-263)
Code:
		local val = EnumerateFrames()
		while val do
			register(val)
			val = EnumerateFrames(val)
		end
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
  Reply With Quote
11-11-12, 11:40 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That error is caused by non-frame tables whose metatable __index is a frame. You can fix it by making your frame check more robust:

Code:
if val.IsProtected 
and val.GetObjectType 
and val.GetScript 
and type(rawget(val, 0)) == "userdata"
and val:GetObjectType() == "CheckButton" 
and val:IsProtected() then
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-11-12, 11:52 PM   #3
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 440
Thanks for that, but still a no go. It just throws an error at the second code snippet I pasted in above.

Code:
Message: Interface\AddOns\ncHoverBind\ncHoverBind.lua:262: EnumerateFrames: Couldn't find 'this' in current object
Time: 11/12/12 00:49:02
Count: 1
Stack: [C]: in function `EnumerateFrames'
Interface\AddOns\ncHoverBind\ncHoverBind.lua:262: in function `?'
Interface\FrameXML\ChatFrame.lua:4358: in function `ChatEdit_ParseText'
Interface\FrameXML\ChatFrame.lua:4052: in function `ChatEdit_SendText'
Interface\FrameXML\ChatFrame.lua:4091: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>

Locals: (*temporary) = <table> {
 1 = <unnamed> {
 }
 2 = <unnamed> {
 }
 3 = <unnamed> {
 }
 4 = <unnamed> {
 }
 0 = <unnamed> {
 }
}
If it helps any, this error only pops its ugly head with SnailUI. ncHoverBind plays nicely with everything else I've tested it with since MOP released.
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".

Last edited by Coote : 11-11-12 at 11:54 PM.
  Reply With Quote
11-12-12, 12:51 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You need to also make sure you don't pass non-frame values back into EnumerateFrames. This is probably the easiest way to do it:

Code:
		local function register(val)
			if val.IsProtected and val.GetObjectType and val.GetScript and type(rawget(val, 0)) == "userdata" and val:GetObjectType()=="CheckButton" and val:IsProtected() then
				local script = val:GetScript("OnClick")
				if script==button then
					val:HookScript("OnEnter", function(self) bind:Update(self) end)
				elseif script==stance then
					val:HookScript("OnEnter", function(self) bind:Update(self, "STANCE") end)
				elseif script==pet then
					val:HookScript("OnEnter", function(self) bind:Update(self, "PET") end)
				end
				return true
			end
		end
Code:
		local val = EnumerateFrames()
		while val do
			if register(val) then
				val = EnumerateFrames(val)
			end
		end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-12-12, 12:59 AM   #5
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 440
Even worse yet. Those changes cause the game client to crash.
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
  Reply With Quote
11-12-12, 02:50 AM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by Phanx View Post
Code:
		local val = EnumerateFrames()
		while val do
			if register(val) then
				val = EnumerateFrames(val)
			end
		end
If register(val) ever returns false or nil, this will send the game into an infinite loop.



Try this with Phanx's other modification to register():
Code:
	local val = EnumerateFrames()
	while val and register(val) do
		val = EnumerateFrames(val)
	end
The only problem with this is when it runs into the error, it'll stop hooking. There isn't any other way around this.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-12-12 at 03:09 AM.
  Reply With Quote
11-12-12, 03:29 AM   #7
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
You just made friends with Blizzard's broken taintLog tracking, say "hi"

/console taintLog 0 and see if the error disappears.

Edit: If you verify that the broken taint log mechanism is at fault you can workaround it by going through both your addons and finding any global frames that are unassigned local references and make sure they're assigned to a local variable.

Last edited by Dridzt : 11-12-12 at 03:58 AM.
  Reply With Quote
11-12-12, 04:54 AM   #8
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 440
That mostly works. No errors, and the binding confirmation pops up. Though, the issue now, after testing it, is binding no longer works with any of these changes.

I've reverted all these changes, and I guess I'll just use a different bar mod rather than trying to get it to play nicely with SnailUI for now.
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
  Reply With Quote
11-12-12, 05:06 AM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, the best solution to the problem would really be to figure out which addon is screwing with frame metatables and get its author to fix the problem.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-12-12, 05:21 AM   #10
Coote
A Scalebane Royal Guard
 
Coote's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 440
Originally Posted by Phanx View Post
Well, the best solution to the problem would really be to figure out which addon is screwing with frame metatables and get its author to fix the problem.
I believe I've narrowed it down to the ActionBar module in SnailUI, and I've contacted the author. I posted this in the chance it may have been my addon, and in hopes there may have been a workaround on my end to get it working properly.

Thanks for the help, and even though it didn't amount to a whole lot in the end run, you guys still rock.
__________________

"This is the fifteen-thousandth four hundredth and ninety-eighth occurence".
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Attempt to find 'this' in non-framescript object?


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