Patch: crash during GC when using combo, listbox

Hi all, I feel like I may have written about this before, apologies if

I recently started getting “object allocation during garbage collection
phase” with wxruby on linux. I traced the problem to GetCount() being
called on list and combo boxes during the GC’s mark phase. Since the
GetCount() method has a director, the C++ call triggers a ruby call that
then allocates a ruby object to store the result, triggering the error.

This patch just disables the director on GetCount(), but that also means
that this method can’t be overriden in Ruby.

I’m also not sure why this just started happening to me. I did shuffle
around some code that may have caused a GC where there wasn’t one
but surely every GC should trigger this problem if my description of the
cause is right?

Index: swig/shared/control_with_items.i

— swig/shared/control_with_items.i (revision 2115)
+++ swig/shared/control_with_items.i (working copy)
@@ -13,6 +13,7 @@
%feature(“nodirector”) *::GetClientObject(int n) const;
%ignore *::SetClientObject(int n, wxClientData * data);
%feature(“nodirector”) *::SetClientObject(int n, wxClientData * data);
+%feature(“nodirector”) *::GetCount() const;

extern swig_class cWxControlWithItems;