From caecd08a77a8fcee95c26a12c8c6ed297627c113 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Wed, 10 Dec 2008 14:12:23 +0000 Subject: [PATCH] kernwin.i: Added workaround for Choose() sometimes crashing with non-modal choosers --- swig/kernwin.i | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/swig/kernwin.i b/swig/kernwin.i index 333a92a..1759e97 100644 --- a/swig/kernwin.i +++ b/swig/kernwin.i @@ -243,6 +243,12 @@ class Choose: self.width = -1 + # HACK: Add a circular reference for non-modal choosers. This prevents the GC + # from collecting the class object the callbacks need. Unfortunately this means + # that the class will never be collected, unless refhack is set to None explicitly. + if (flags & 2) == 0: + self.refhack = self + def sizer(self): """ Callback: sizer - returns the length of the list