From 8d699f6ff85bf80fb1bfced8576bcbb5c4ebb97e Mon Sep 17 00:00:00 2001 From: theraven Date: Sun, 7 Aug 2011 16:56:58 +0000 Subject: [PATCH] When calling -.cxx_dealloc, look up the superclass before calling. This method may destroy the receiver's class, if it's a user-generated one, so we can't guarantee that it is valid after the call. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33701 72102866-910b-0410-8b05-ffd578937521 --- Source/NSObject.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/NSObject.m b/Source/NSObject.m index 1fa4b1d64..5cb5127fe 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -1436,12 +1436,13 @@ static id gs_weak_load(id obj) newDestructor = class_getMethodImplementation(destructorClass, cxx_destruct); + destructorClass = class_getSuperclass(destructorClass); + if (newDestructor != destructor) - { + { newDestructor(self, cxx_destruct); destructor = newDestructor; } - destructorClass = class_getSuperclass(destructorClass); } return; }