make notification more robust

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32430 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-03-01 20:39:14 +00:00
parent bf05e6fe8b
commit f6293dd808
2 changed files with 12 additions and 0 deletions

View file

@ -1,4 +1,11 @@
2011-03-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyValueObserving.m:
Retain object while sending notifications so we don't get deallocated
during the process.
2011-03-01 Niels Grewe <niels.grewe@halbordnung.de>
* Source/GSNetServices.h
* Headers/Additions/GNUstepBase/NSNetServices+GNUstepBase.h:
Declare a protocol for GNUstep specific delegate methods in

View file

@ -991,6 +991,10 @@ replacementForClass(Class c)
newValue = null;
}
/* Retain self so that we won't be deallocated during the
* notification process.
*/
[self retain];
count = [observations count];
while (count-- > 0)
{
@ -1028,6 +1032,7 @@ replacementForClass(Class c)
[oldValue release];
[change setObject: newValue forKey: NSKeyValueChangeNewKey];
[newValue release];
[self release];
}
@end