From: John L. <jla...@gm...> - 2005-12-25 18:13:10
|
> I can compile and link the lua libraries + my own wrappings, but as soon > as i add the next two members to any app, and run that app (doing > really nothing with lua ), i get the crash with stack down here. > This is during m_classinfo static member initialization for > IMPLEMENT_DYNAMIC_CLASS. > It is always the same problm, but if i do the same in any another app, i > get it it the first class initialized all the time. Without the > WxLuaState added, it work fine. Humm, what compiler, version of wxWidgets? > I did check if i only link the need lua libs ones only, and it seems so > from the list i see. > I saw some time a ago (when you were working on wxLua ), when > compiling/linking you had an overview in the output window of linked > libraries, how did you make that setting? Maybe that will tell me more. I haven't seen this using VC6 or in gcc. I did have some problems with VC 2003, the free command line one, but I thought it was an oddity. > class MyApp: public wxApp > { > public: > MyApp(); > > virtual bool OnInit(); > virtual int OnExit(); > > MyFrame *m_frame; > wxLuaState m_wxlState; > lua_State *m_luaState; > }; You should access the lua_State through the m_wxlState.GetLuaState(). The app wxLua still has the lua_State as a member as a throwback to the old way and will be removed when I get a chance. The whole idea of using the wxLuaState is that you won't have problems of destroying the pointer to the lua_State and then trying to access it later. > NTDLL! 77f7f570() > NTDLL! 77f67dc6() > KERNEL32! 77e6c936() > _CrtIsValidHeapPointer(const void * 0x00322bf0) line 1697 > _free_dbg_lk(void * 0x00322bf0, int 1) line 1044 + 9 bytes > _free_dbg(void * 0x00322bf0, int 1) line 1001 + 13 bytes > free(void * 0x00322bf0) line 956 + 11 bytes > wxListKey::~wxListKey() line 379 + 15 bytes > wxListBase::Append(const char * 0x00d166fc, void * 0x00e1be50 class What is this string? It should be the name of the class it's trying to add. I have no idea why this should happen. I guess the stack is getting messed up by some earlier static initialization and carrying through. This will be tough to track through, We can look at the linking order of the object files to follow them backwards to see what is being initialized before this code is run. > wxClassInfo wxEvtHandler::ms_classInfo) line 273 > wxObjectList::Append(const char * 0x00d166fc, void * 0x00e1be50 class > wxClassInfo wxEvtHandler::ms_classInfo) line 1122 + 30 bytes > wxHashTable::Put(const char * 0x00d166fc, wxObject * 0x00e1be50 class > wxClassInfo wxEvtHandler::ms_classInfo) line 485 > wxClassInfo::Register() line 245 > wxClassInfo::wxClassInfo(const char * 0x00d166fc, const wxClassInfo * > 0x00e1be80 class wxClassInfo wxObject::ms_classInfo, const wxClassInfo * > 0x00000000, int 40, wxObject * (void)* 0x00408242 > wxEvtHandler::wxCreateObject(void)) line 77 > $E31() line 66 + 32 bytes > $E35() + 8 bytes > _initterm(void (void)* * 0x00d14114 $S36, void (void)* * 0x00d1600c > ___xc_z) line 525 > WinMainCRTStartup() line 274 + 15 bytes > KERNEL32! 77e7eb69() Regards, John Labenski |