CRASH: Runtime Error: widget.lua:27 attempt to index field'?' (a function value)

This is an old issue and I’m not sure why it isn’t fixed yet.  I submitted a bug fix for it some time ago.

I’ll do so again when I get my internet back (currently at neighbor’s house borrowing wifi to check emails; comcast cut my phone/internet cable while digging in my yard to fix neighbor’s internet.  I’m frontier so I have to wait a week+ for a fix. Irony…)

The scroller widget (and others) have this issue.

Basically, the widget is trying to access a non-existent object after you delete the widget.  

If you’re in a real hurry you can get my fixed code for this.  Warning may be out of date with latest widget lib.

  1. Download RG Free stuff repository and unzip it:  https://github.com/roaminggamer/RG_FreeStuff

  2. Copy folder “~/SSK2/tools/eat_free/widgetLibrary”  to your project.

  3. Copy this file to your project in same location as main.lua:  “SSK2/tools/eat_free/scripts/widgetFix.lua”

  4. Edit your main.lua to have this as the FIRST line

    require “widgetFix”

When I file the fix for this, I’ll ping you back with the latest fix code matching the latest version of the widget library (I think the public one is a little ahead of my fixed one).

just grab the widget library from github ad fix the problem yourself?

As I’m not using Enterprise, and widget.lua is not in my project folder, what should I do precisely?

If widget.lua is not in my project folder, where can I find it to solve this problem? And can I fix it without having to use Enterprise?

You don’t need enterprise.  Source is on github here - https://github.com/coronalabs/framework-widget

The widgets are just in Lua using Corona APIs. Native wouldn’t help you with this.

Rob

@Rob, if “The widgets are just in Lua using Corona APIs”, what can I do? Am I sunk until your team incorporates the fix referred to by roaminggamer above?

@roaminggamer and @sphere,

I don’t know how to incorporate your fix, as I’m not using the native APIs. Looking at the source, it appears that the widget is an entire Corona project. So, how would I run it (as a project) within my own project?

Please forgive me if this question is so elementary.

You would need to copy the widget folder to your project and then require it instead of the actual widget plugin

@roaminggamer,

When did you submit this fix for the issue? Did you create a pull request on the widget repo so that we can inspect? I can investigate your fix and roll it into the official widget library if you provide me context on the matter.

Thanks,

Brent

@troy,

I gave step by step directions above.  This is not an enterprise thing.

@Brent,

It was a long time ago and I currently have limited internet availability.  I’ll investigate further when I get my internet connection back (still using neighbors WIFI)  and after I get caught back up with client work.,

Ed

Hi @troylyndon,

Can you provide some basic clarity on this issue? Starting with which widget is triggering the error? And ideally, what basic user action (or code) is being executed right before the error is triggered?

Thanks,

Brent

@troy are you using the latest Corona build?

As line 27 is

if group[i].\_isWidget then

and I doubt that would raise this error you are seeing

His error may be from a different version of the widget lib.

The main issue I found with the widget library a while back was…

At least one enterFrame listener that survived  the removal of a widget when the parent of the widget was removed.  This listener continued to run and attempted to affect non-existent entities.

In ‘widget_momentumScrolling.lua’,  I replaced this code:

 -- EnterFrame listener for our scrollView function view:enterFrame( event ) local \_scrollView = self.parent

With this:

 -- EnterFrame listener for our scrollView function view:enterFrame( event ) if( not self.parent ) then Runtime:removeEventListener( "enterFrame", self ) return true end local \_scrollView = self.parent

At least one other widget has a similar section of code, but I can’t remember it right now.

In any case, this may be the root of the issue.

Hi Ed,

I appreciate the clarification! A few widgets “share” the momentum scrolling code, so I’ll check into adding what you suggest and do some testing on it.

Thanks,

Brent

@Brent, can you fix this today or Monday? It’s a serious problem that occurs infrequently and inconsistently between 2-10 hours of play. Our product update can not be published until I find a way to resolve this or remove the widget. I’d show you a screen shot, but this forum will not allow me to upload any files.

Hi Troy,

I already fixed it, just forgot to notify you (sorry). You’ll need to grab build 3106 or higher for this.

https://developer.coronalabs.com/release/2017/3106/

Best regards,

Brent

@Brent and RG, Thank you. I’ll download the latest build and restart our testing procedures again.