Hi John,

I did all you suggested, but the problem is, it does not fail where you expect 
it. This does not mean that the error is not created where you think.

With this here added as you suggested, the output is as i expected.

     wxLogDebug(wxT("pushuserdatatype1 %p %p pushing %p type %d\n"),
a2dLuaWP, a2dMaskProc, obj_ptr, wxl_type);

         if (wxluaO_istrackedweakobject(L, (void*)obj_ptr, wxl_type, true))
             return true;

   wxLogDebug(wxT("pushuserdatatype2 %p %p pushing %p type %d\n"),
a2dLuaWP, a2dMaskProc, obj_ptr, wxl_type);

========= OUTPUT ===============

14:43:47: pushuserdatatype1 020062B0 020062B0 pushing 020062B0 type 426

14:43:47: pushuserdatatype2 020062B0 020062B0 pushing 020062B0 type 426

14:44:21: pushuserdatatype1 020062B0 020062B0 pushing 020062B0 type 429

14:44:21: pushuserdatatype2 020062B0 020062B0 pushing 020062B0 type 429

First-chance exception in maskproc.exe: 0xC0000005: Access Violation.
First-chance exception in maskproc.exe (KERNEL32.DLL): 0xE06D7363: Microsoft 
C++ 
Exception.



Here the second time the same pointer is pushed, i get the exception with the 
stack dump at the end of this mail. From the output it is clear I do not have a 
tracked object/pointer, because in both cases false is returned.

Now the second time the same pointer is pushed, it follows a different path in 
this function here, but in both cases the return is false. But the first time
it skips the "if (lua_istable(L, -1))" part, while the second it goes in there,
but the "if (wxlua_iswxuserdata(L, -1) && (wxl_type == wxluaT_type(L, 
-1)))"part 
is skipped.


bool LUACALL wxluaO_istrackedweakobject(lua_State *L, void *obj_ptr, int 
wxl_type, bool push_on_stack)
{
     lua_pushlightuserdata(L, &wxlua_lreg_weakobjects_key); // push key
     lua_rawget(L, LUA_REGISTRYINDEX);   // pop key, push value (the obj table)

     lua_pushlightuserdata(L, obj_ptr); // push key
     lua_rawget(L, -2);                 // get t[key] value; pop key push value

     if (lua_istable(L, -1))
     {

Hope you can do something, knowing this.

Klaas


===============Stack ================

luaO_rawequalObj(const lua_TValue * 0x4d6584b1, const lua_TValue * 0x02006608) 
line 73 + 6 bytes
luaH_get(Table * 0x02174b60, const lua_TValue * 0x02006608) line 484 + 16 bytes
luaH_set(lua_State * 0x02006318, Table * 0x02174b60, const lua_TValue * 
0x02006608) line 495 + 13 bytes
lua_rawset(lua_State * 0x02006318, int -3) line 673 + 37 bytes
wxLuaBinding::DoRegisterBinding(const wxLuaState & {...}, int 1) line 1191 + 11 
bytes
wxLuaBinding::RegisterBinding(const wxLuaState & {...}) line 985
wxLuaState::RegisterBindings() line 2687 + 17 bytes
wxLuaState::Create(lua_State * 0x02006318, int 2) line 2221
wxLuaState::Create(wxEvtHandler * 0x01f71730, int -1) line 2116 + 14 bytes
wxLuaState::wxLuaState(wxEvtHandler * 0x01f71730, int -1) line 651 + 75 bytes
MaskprocLuaWrapper::MaskprocLuaWrapper(a2dCentralCanvasCommandProcessor * 
0x01ff8048) line 569 + 16 bytes
MyApp::OnInit() line 354 + 72 bytes
wxAppConsole::CallOnInit() line 76 + 28 bytes
wxEntryReal(int & 1, char * * 0x01f70f40) line 440 + 25 bytes
wxEntry(int & 1, char * * 0x01f70f40) line 209 + 13 bytes
wxEntry(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, HINSTANCE__ * 
0x00000000, int 1) line 386 + 13 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00051f1e, 
int 1) line 208 + 24 bytes
WinMainCRTStartup() line 330 + 54 bytes
KERNEL32! 77e735dd()



John Labenski wrote:

> 
> I assume it will still fail and I'm guessing in this function. Try
> putting some statements like this into it for debugging.
> 
> bool LUACALL wxluaT_pushuserdatatype(lua_State* L, const void
> *obj_ptr, int wxl_type, bool track, bool allow_NULL)
> {
> ...
>     wxPrintf(wxT("pushuserdatatype1 %p %p pushing %p type %d\n"),
> a2dLuaWP, a2dMaskProc, obj_ptr, wxl_type);
>         if (wxluaO_istrackedweakobject(L, (void*)obj_ptr, wxl_type, true))
>             return true;
>     wxPrintf(wxT("pushuserdatatype2 %p %p pushing %p type %d\n"),
> a2dLuaWP, a2dMaskProc, obj_ptr, wxl_type);
> 
> 
> Then if it fails the second time it was pushed I'd guess it was inside
> of wxluaO_istrackedweakobject and see where it fails there.
> 


-- 
Unclassified

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to