mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-21 02:20:55 +00:00
* 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:
parent
51c4edbfd8
commit
5779cc0f8b
4 changed files with 30 additions and 3 deletions
11
ChangeLog
11
ChangeLog
|
@ -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>
|
2006-09-12 David Ayers <ayers@fsfe.org>
|
||||||
|
|
||||||
* Version: Update to 0.10.0
|
* Version: Update to 0.10.0
|
||||||
|
|
|
@ -4048,6 +4048,7 @@ static BOOL usesContextRelativeEncoding = NO;
|
||||||
[EOAssociationClass objectDeallocated: self];
|
[EOAssociationClass objectDeallocated: self];
|
||||||
NSHashRemove(assocDeallocHT,self);
|
NSHashRemove(assocDeallocHT,self);
|
||||||
}
|
}
|
||||||
|
[EOObserverCenter _forgetObject:self];
|
||||||
|
|
||||||
/* We cannot if (0) [super dealloc]; as NSObject does not have superclass. */
|
/* We cannot if (0) [super dealloc]; as NSObject does not have superclass. */
|
||||||
NSDeallocateObject (self);
|
NSDeallocateObject (self);
|
||||||
|
|
|
@ -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
|
* This method is invoked from [NSObject-willChange] to dispatch
|
||||||
* [EOObserving-objectWillChange:] to all observers registered
|
* [EOObserving-objectWillChange:] to all observers registered
|
||||||
|
@ -191,16 +196,21 @@ static id lastObject;
|
||||||
|
|
||||||
if (!notificationSuppressCount)
|
if (!notificationSuppressCount)
|
||||||
{
|
{
|
||||||
|
SEL objectWillChangeSel = @selector(objectWillChange:);
|
||||||
EOFLOGObjectLevelArgs(@"EOObserver", @"object=%p lastObject=%p",
|
EOFLOGObjectLevelArgs(@"EOObserver", @"object=%p lastObject=%p",
|
||||||
object, lastObject);
|
object, lastObject);
|
||||||
|
|
||||||
if (object == nil)
|
if (object == nil)
|
||||||
lastObject = nil;
|
{
|
||||||
|
lastObject = nil;
|
||||||
|
[omniscientObservers makeObjectsPerform:objectWillChangeSel
|
||||||
|
withObject:nil];
|
||||||
|
|
||||||
|
}
|
||||||
else if (lastObject != object)
|
else if (lastObject != object)
|
||||||
{
|
{
|
||||||
GDL2NonRetainingMutableArray *observersArray;
|
GDL2NonRetainingMutableArray *observersArray;
|
||||||
int c;
|
int c;
|
||||||
SEL objectWillChangeSel = @selector(objectWillChange:);
|
|
||||||
|
|
||||||
lastObject = object;
|
lastObject = object;
|
||||||
|
|
||||||
|
@ -215,7 +225,7 @@ static id lastObject;
|
||||||
EOFLOGObjectLevelArgs(@"EOObserver", @"omniscientObservers count=%d",
|
EOFLOGObjectLevelArgs(@"EOObserver", @"omniscientObservers count=%d",
|
||||||
c);
|
c);
|
||||||
[omniscientObservers makeObjectsPerform:objectWillChangeSel
|
[omniscientObservers makeObjectsPerform:objectWillChangeSel
|
||||||
withObject:nil];
|
withObject:object];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSHashTable.h>
|
#include <Foundation/NSHashTable.h>
|
||||||
|
#include <EOControl/EOObserver.h>
|
||||||
#include "EODefines.h"
|
#include "EODefines.h"
|
||||||
|
|
||||||
@class NSNumber;
|
@class NSNumber;
|
||||||
|
@ -376,6 +377,10 @@ GDL2CONTROL_EXPORT void EOHashAddTable(NSHashTable *to, NSHashTable *from);
|
||||||
- (void) registerAssociationForDeallocHack:(id)object;
|
- (void) registerAssociationForDeallocHack:(id)object;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface EOObserverCenter(EOPrivate)
|
||||||
|
+ (void) _forgetObject:(id)object;
|
||||||
|
@end
|
||||||
|
|
||||||
@interface GDL2NonRetainingMutableArray : NSMutableArray
|
@interface GDL2NonRetainingMutableArray : NSMutableArray
|
||||||
{
|
{
|
||||||
void *_contents;
|
void *_contents;
|
||||||
|
|
Loading…
Reference in a new issue