On Thu, Mar 6, 2008 at 3:50 AM, Eero Pajarre <[EMAIL PROTECTED]> wrote: > My memory corruption error may very well be the same problem > as reported under wxGridCellRenderer/ wxGridCellEditor problem. > > Current evidence points to that direction. > > (I am now wondering should wxadv_bind.cpp use > wxLUA_IMPLEMENT_wxGridCellWorker_ENCAPSULATION > instead of wxLUA_IMPLEMENT_ENCAPSULATION > for wxGridCellChoiceEditor etc... > > Changing that seems to help on the crashing)
Yes, I found and fixed that problem (wxGridCellWorker derived classes have protected destructors so you cannot call 'delete' on them, you must call DecRef()), but there is another problem that is not as simple. When the wxGrid is destroyed; wxWidgets will also delete all the children windows of the wxGrid, including any wxControls that the wxGridCellEditors have created. However the wxGrid has no mechanism to set the m_control pointer in the wxGridCellEditor to NULL if the wxControl is deleted by someone else, wxWidgets in this case. This means that when the wxGridCellEditor itself is destroyed it will try to delete the m_control a second time since it's not NULL. I need to find out why this works in C++, but not with wxLua. As far as I can tell there should be absolutely no difference. Regards, John ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. 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