|
From: John L. <jla...@gm...> - 2007-07-31 01:35:56
|
On 7/30/07, Andre <ar...@ki...> wrote:
> Hi
>
> I have encountered this error numerous time using the current version.
> Notice that notebook.PageCount works but notebook:GetPageCount() invoking the
> same funtion fails.
> I have tried to track it in the debugger but no luck so far.
>
>
> 671 if (selection >= 0) and (selection < notebook.PageCount) then
> 672-> editor = notebook:GetPage(selection):DynamicCast("wxStyledTextCtrl")
> assert(editor )
> end
>
>
> lua: Error while running chunk
> C:\Programs\wxWidgets\wxLua\samples\lunedit.wx.lua:672: attempt to call method
> 'GetPage' (a userdata value)
> stack traceback:
> C:\Programs\wxWidgets\wxLua\samples\lunedit.wx.lua:672: in function 'GetEditor'
> C:\Programs\wxWidgets\wxLua\samples\lunedit.wx.lua:1821: in function
> <C:\Programs\wxWidgets\wxLua\samples\lunedit.wx.lua:1820>
>
> -----------------------changing notebook.PageCount to notebook:GetPageCount()
>
> will cause the error to be on notebook:GetPageCount()
>
> this occurs from time to time
It looks like the stack is corrupted and the "GetPage" is function is
getting swapped with a userdata which is perhaps the notebook.
I cannot duplicate this with the choices.wx.lua sample where I added
this to the HandleEvents(event) function after making the "notebook"
variable global.
print(notebook:GetPageCount())
print(notebook:GetPage(0), notebook:GetPage(0):DynamicCast("wxPanel"):GetName())
However, there is a bug in the last version where the wxLuaFunctions
(wrappers around the C functions called for each wrapped method) are
tracked, but then not cleared. The lua registry table that tracks
things to be deleted would clear the wrong item if the memory location
is reused. This may explain why it happens after use for a long time.
I'll try to do a binary release tomorrow, the source will have to wait
since the configure script is still not working.
Regards,
John Labenski
|