Crash occured when trying to construct binded class

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Crash occured when trying to construct binded class

"Голубев С.В."
Hi, Arvid. I have some troubles.
In C++ side i bind multiple-derived class with this code:

class_<ww_dialog,bases<ww_gui_control,ww_event_manager> >("ww_dialog")
    .def(constructor<>())
/*
properties and methods
*/


In luabind side i derives from this class:

class 'dialog' (ww_dialog)
function dialog:__init()
    print("Test")
    super() <-     here segmentation fault occured
    print("Second test")
end


when I try to debug my code, I found that luabind does not call any
constructor of C++ classes. When I analyze global table in LUA, i find
the entry with name ww_dialog of type userdata, so I think, that class
ww_dialog has been succesfully registered in lua.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Crash occured when trying to construct binded class

Arvid Norberg-2

On Oct 5, 2006, at 17:00, Голубев С.В. wrote:

> Hi, Arvid. I have some troubles.
> In C++ side i bind multiple-derived class with this code:
>
> class_<ww_dialog,bases<ww_gui_control,ww_event_manager> >("ww_dialog")
>     .def(constructor<>())
> /*
> properties and methods
> */
>
>
> In luabind side i derives from this class:
>
> class 'dialog' (ww_dialog)
> function dialog:__init()
>     print("Test")
>     super() <-     here segmentation fault occured
>     print("Second test")
> end
>
>
> when I try to debug my code, I found that luabind does not call any
> constructor of C++ classes. When I analyze global table in LUA, i find
> the entry with name ww_dialog of type userdata, so I think, that class
> ww_dialog has been succesfully registered in lua.

The C++ constructor is called before the __init() function is called.  
super() is used to call lua base classes.
Maybe there's a bug when calling super() without deriving from a lua  
class, can you see where it segfaults? and the callstack to that place?

--
Arvid Norberg



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user