From 2ebd5eafbe50d5a38464422e1db38d0cf47795c1 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Tue, 22 Jul 2008 16:31:08 +0100 Subject: [PATCH] Fix reference counting problem, triggered by subclass-able class not being subclassed, which is detected only by a debug Python build. --- pybindgen/cppclass.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pybindgen/cppclass.py b/pybindgen/cppclass.py index 19ae218..f144e9b 100644 --- a/pybindgen/cppclass.py +++ b/pybindgen/cppclass.py @@ -1587,9 +1587,9 @@ static void else: peekref_code = " && self->obj->%s() == 1" % self.memory_policy.peekref_method visit_self = ''' - if (self->obj %s) + if (self->obj && typeid(*self->obj) == typeid(%s) %s) Py_VISIT((PyObject *) self); -''' % (peekref_code) +''' % (self.helper_class.name, peekref_code) code_sink.writeln(r''' static int