Hi Andreas, > I'm trying to understand how wxLua handles its event mechanism. I can see that > for every call to Connect(), wxLua will create a new object of > wxLuaEventCallback. > But I don't see where these get deleted.
If you want to delete callbacks explicitly, there is Disconnect() call. I haven't looked at the wxlua source, but as far as I understand, callbacks should be removed when Disconnect is called (I use it in several places in my application). Paul. On Sat, Oct 5, 2013 at 10:45 AM, Andreas Falkenhahn <andr...@falkenhahn.com> wrote: > Hi, > > I'm trying to understand how wxLua handles its event mechanism. I can see that > for every call to Connect(), wxLua will create a new object of > wxLuaEventCallback. > But I don't see where these get deleted. > > My assumption is that whenever a window is closed, wxLuaWinDestroyCallback > will > do the cleaning up and AFAICS it iterates over all event callbacks and calls > > wxlCallback->ClearwxLuaState(); > > on every callback it finds. But it also does the following: > > wxluaR_unref(L, wxlCallback->GetLuaFuncRef(), &wxlua_lreg_refs_key); > > This is confusing me because this is also done in the wxLuaEventCallback dtor: > > m_wxlState.wxluaR_Unref(m_luafunc_ref, &wxlua_lreg_refs_key); > > So are function references possibly removed twice here? > > But back to my original question: I'd like to know which code causes the > wxLuaEventCallback dtor to be called. My assumption is that it is > ClearWxLuaState() > because that decrements the reference count and then the object might be > marked > for garbage collection by the wxWidgets main loop. > > But I don't know enough about C++ and wxWidgets so I'd really be glad if > somebody could tell me if my assumption is right. I just need to know what > code in wxLua triggers the wxLuaEventCallback dtor. > > Thanks! > > -- > Best regards, > Andreas Falkenhahn mailto:andr...@falkenhahn.com > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > wxlua-users mailing list > wxlua-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wxlua-users ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users