// Works around BXC #3801 - Managed Container subclasses are incorrectly resurrected, then leak. // It does this by registering an alternative callback for gtksharp_container_override_forall, which // ignores callbacks if the wrapper no longer exists. This means that the objects no longer enter a // finalized->release->dispose->re-wrap resurrection cycle. // We use a dynamic method to access internal/private GTK# API in a performant way without having to track // per-instance delegates. public static void FixContainerLeak(Gtk.Container c) { if (containerLeakFixed) { return; } FixContainerLeak(c.GetType()); }
private Cell GetXamarinFormsCell(Gtk.Container cell) { try { var formsCell = cell .GetType() .GetProperty("Cell") .GetValue(cell, null) as Cell; return(formsCell); } catch { return(null); } }