* EOControl/EOObserver.m (EOObserverCenter +_forgetObject:): New

private method.
        (+notifyObserversObjectWillChange:): Change omniscient observer
        arguments.
        * EOControl/EOEditingContext.m (NSObject -dealloc): Call
        _forgetObject:.
        * EOControl/EOPrivate.h: Add category for EOObserverCenter private
        methods.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@23490 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2006-09-13 20:44:53 +00:00
parent 51c4edbfd8
commit 5779cc0f8b
4 changed files with 30 additions and 3 deletions

View file

@ -1,3 +1,14 @@
2006-09-13 Matt Rice <ratmice@yahoo.com>
* EOControl/EOObserver.m (EOObserverCenter +_forgetObject:): New
private method.
(+notifyObserversObjectWillChange:): Change omniscient observer
arguments.
* EOControl/EOEditingContext.m (NSObject -dealloc): Call
_forgetObject:.
* EOControl/EOPrivate.h: Add category for EOObserverCenter private
methods.
2006-09-12 David Ayers <ayers@fsfe.org>
* Version: Update to 0.10.0

View file

@ -4048,6 +4048,7 @@ static BOOL usesContextRelativeEncoding = NO;
[EOAssociationClass objectDeallocated: self];
NSHashRemove(assocDeallocHT,self);
}
[EOObserverCenter _forgetObject:self];
/* We cannot if (0) [super dealloc]; as NSObject does not have superclass. */
NSDeallocateObject (self);

View file

@ -172,6 +172,11 @@ static id lastObject;
}
}
+ (void)_forgetObject:(id)object
{
if (lastObject == object) lastObject = nil;
}
/**
* This method is invoked from [NSObject-willChange] to dispatch
* [EOObserving-objectWillChange:] to all observers registered
@ -191,16 +196,21 @@ static id lastObject;
if (!notificationSuppressCount)
{
SEL objectWillChangeSel = @selector(objectWillChange:);
EOFLOGObjectLevelArgs(@"EOObserver", @"object=%p lastObject=%p",
object, lastObject);
if (object == nil)
lastObject = nil;
{
lastObject = nil;
[omniscientObservers makeObjectsPerform:objectWillChangeSel
withObject:nil];
}
else if (lastObject != object)
{
GDL2NonRetainingMutableArray *observersArray;
int c;
SEL objectWillChangeSel = @selector(objectWillChange:);
lastObject = object;
@ -215,7 +225,7 @@ static id lastObject;
EOFLOGObjectLevelArgs(@"EOObserver", @"omniscientObservers count=%d",
c);
[omniscientObservers makeObjectsPerform:objectWillChangeSel
withObject:nil];
withObject:object];
}
}

View file

@ -29,6 +29,7 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSHashTable.h>
#include <EOControl/EOObserver.h>
#include "EODefines.h"
@class NSNumber;
@ -376,6 +377,10 @@ GDL2CONTROL_EXPORT void EOHashAddTable(NSHashTable *to, NSHashTable *from);
- (void) registerAssociationForDeallocHack:(id)object;
@end
@interface EOObserverCenter(EOPrivate)
+ (void) _forgetObject:(id)object;
@end
@interface GDL2NonRetainingMutableArray : NSMutableArray
{
void *_contents;