From: k. h. <kla...@nl...> - 2006-01-17 14:20:56
|
Hi, I think there is someting wrong with the whole binding registration, and that because of that things get mixed up. In wxLuaBinding::RegisterGeneratedClasses() i enabled the print wxLogDebug(wxT("RegisterGenClasses %d '%s'\n"), iTag, lua2wx(pClass->name).c_str()); And i see that my object becomes registrated, but with the same itag as the wx binding. I don't know if this is what casuing it?? 14:14:15: RegisterGenClasses 4 'wxlCanObj' 14:14:31: RegisterGenClasses 4 'wxPageSetupDialogData' Later on i run the next lua script from a file: blah = wx.wxPageSetupDialogData() blah:GetPaperSize() canobj = wxluacan.wxlCanObj() canobj:Draw( bitmapDC, 0, 0 ) The canobj is really constructed ( breakspoint in C++), but function Draw is called on the wrong object, in fact it is called on the wx namespace object with the same iTag being 4. So the first function is oke, but the second fails. And that is because the pclass is the one of the wxPageSetupDialogData, and not of the wxlCanObj. wxLua_lua_getTableFunc(lua_State *L) in the end is able to print the function called, and the output indictaes that soemthing is wrong indeed: 14:53:30: class wxPageSetupDialogData function GetPaperSize 14:53:43: wxLua_lua_getTableFunc 'GetPaperSize' pClass 11590824, userdata 1, lightuserdata 0, ttag 4, class_tag 4 lua_State 26287736 wxLuaStateRefData 26278328 14:53:51: class wxPageSetupDialogData function Draw 14:53:52: wxLua_lua_getTableFunc 'Draw' pClass 11590824, userdata 1, lightuserdata 0, ttag 4, class_tag 4 lua_State 26287736 wxLuaStateRefData 26278328 This is all easy to reproduce on the sample i made. This evening i will upload this one, with the right rules and wxluacan.i file. It looks like the namespace is skipped or it is not legal to have classes with the same iTag?? What is this Itag?? This is the stack when ariving at 14:53:43: wxLua_lua_getTableFunc(lua_State * 0x01911e78) line 137 luaD_precall(lua_State * 0x01911e78, lua_TObject * 0x01912118) line 260 + 18 bytes luaD_call(lua_State * 0x01911e78, lua_TObject * 0x01912118, int 1) line 311 + 13 bytes callTMres(lua_State * 0x01911e78, const lua_TObject * 0x0191e718, const lua_TObject * 0x019120c8, const lua_TObject * 0x0199a398) line 105 + 21 bytes luaV_getnotable(lua_State * 0x01911e78, const lua_TObject * 0x019120c8, lua_TObject * 0x0199a398, int 0) line 140 + 21 bytes luaV_execute(lua_State * 0x01911e78) line 518 + 25 bytes luaD_call(lua_State * 0x01911e78, lua_TObject * 0x019120b8, int -1) line 313 + 9 bytes f_call(lua_State * 0x01911e78, void * 0x015bf9f0) line 672 + 22 bytes luaD_rawrunprotected(lua_State * 0x01911e78, void (lua_State *, void *)* 0x006624a1 f_call(lua_State *, void *), void * 0x015bf9f0) line 88 + 13 bytes luaD_pcall(lua_State * 0x01911e78, void (lua_State *, void *)* 0x006624a1 f_call(lua_State *, void *), void * 0x015bf9f0, int 144, int 0) line 416 + 17 bytes lua_pcall(lua_State * 0x01911e78, int 0, int -1, int 0) line 685 + 32 bytes wxLuaState::LuaDoFile(const wxString & {...}) line 2218 + 15 bytes wxLuaState::RunFile(const wxString & {...}) line 919 + 12 bytes MyFrame::OnRunScript(wxCommandEvent & {...}) line 265 + 18 bytes This is the stack when ariving at 14:53:52: wxLua_lua_getTableFunc(lua_State * 0x01911e78) line 137 luaD_precall(lua_State * 0x01911e78, lua_TObject * 0x01912118) line 260 + 18 bytes luaD_call(lua_State * 0x01911e78, lua_TObject * 0x01912118, int 1) line 311 + 13 bytes callTMres(lua_State * 0x01911e78, const lua_TObject * 0x0191e718, const lua_TObject * 0x019120c8, const lua_TObject * 0x0199a3d8) line 105 + 21 bytes luaV_getnotable(lua_State * 0x01911e78, const lua_TObject * 0x019120c8, lua_TObject * 0x0199a3d8, int 0) line 140 + 21 bytes luaV_execute(lua_State * 0x01911e78) line 518 + 25 bytes luaD_call(lua_State * 0x01911e78, lua_TObject * 0x019120b8, int -1) line 313 + 9 bytes f_call(lua_State * 0x01911e78, void * 0x015bf9f0) line 672 + 22 bytes luaD_rawrunprotected(lua_State * 0x01911e78, void (lua_State *, void *)* 0x006624a1 f_call(lua_State *, void *), void * 0x015bf9f0) line 88 + 13 bytes luaD_pcall(lua_State * 0x01911e78, void (lua_State *, void *)* 0x006624a1 f_call(lua_State *, void *), void * 0x015bf9f0, int 144, int 0) line 416 + 17 bytes lua_pcall(lua_State * 0x01911e78, int 0, int -1, int 0) line 685 + 32 bytes wxLuaState::LuaDoFile(const wxString & {...}) line 2218 + 15 bytes wxLuaState::RunFile(const wxString & {...}) line 919 + 12 bytes Hope this is enough to find the bug, i don't know how to solve it myself. regards, Klaas -- Unclassified |