gre.delete_control throwing malloc error

Questions and information about using Lua scripting with Storyboard

Moderator: jamiev

gre.delete_control throwing malloc error

Postby wholland » Thu Dec 17, 2015 3:23 pm

This issue has me scratching my head. I'm using gre.clone_control to draw trend lines. When I need to refresh the trend lines (because the data or its range has changed), I want to delete the old lines before drawing new ones. Doing so always deletes properly the first time, but any subsequent calls throw the following error:

Code: Select all
sbengine(672,0x7fff7b55d300) malloc: *** error for object 0x102afa0b0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug


Are there any common 'gotchas' regarding clone/delete? I'd assume that memory allocation isn't something I'm expected to manage from the lua level, so I'm either passing bad parameters or something is broken. The suggestion to "set a breakpoint in malloc_error_break" seems like a red herring since this error is originating way down in the guts of something I have no real access to anyways.

I've attached a test file that recreates the issue I'm having. Add a control to your screen called "TrendLine" that has a polygon render extension with its "Points" attribute mapped to a variable called "points" and its "Style" attribute set to "line" (and some buttons that call CloneControls and DeleteControls respectively).

To recreate the problem, press clone more than once then press delete.
Attachments
CloneDeleteTest.lua
(2.28 KiB) Downloaded 772 times
wholland
 
Posts: 2
Joined: Thu Dec 17, 2015 11:44 am

Re: gre.delete_control throwing malloc error

Postby ChrisK » Thu Dec 17, 2015 3:38 pm

Thanks for the test script. I'll look into this and get back to you.
ChrisK
 
Posts: 38
Joined: Wed Nov 04, 2009 3:34 pm

Re: gre.delete_control throwing malloc error

Postby ChrisK » Fri Dec 18, 2015 11:22 am

Thanks for your patience wholland. Your test case has uncovered a bug in our Storyboard engine which will be resolved for our 4.2 Release in January.

Should you need a solution in the meantime, we can work with you in that regard :)
ChrisK
 
Posts: 38
Joined: Wed Nov 04, 2009 3:34 pm

Re: gre.delete_control throwing malloc error

Postby wholland » Fri Dec 18, 2015 11:44 am

Thanks for confirming that! I think for now, I'm just going to hide things instead of deleting them, and live with the extra overhead that will incur until it's fixed (it's not like i'm refreshing 60 times a second - just once per input). If you have a less wasteful hack/workaround I'm certainly interested in hearing it.
wholland
 
Posts: 2
Joined: Thu Dec 17, 2015 11:44 am


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron