mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Fixes for tests with weak pointers in notification observers.
This commit is contained in:
parent
b41e352662
commit
0ede979d15
5 changed files with 15 additions and 6 deletions
|
@ -5,8 +5,10 @@
|
||||||
* Source/GSPrivate.h:
|
* Source/GSPrivate.h:
|
||||||
* Source/NSConcreteHashTable.m:
|
* Source/NSConcreteHashTable.m:
|
||||||
* Source/NSConcretePointerFunctions.h:
|
* Source/NSConcretePointerFunctions.h:
|
||||||
|
* Source/NSMessagePort.m:
|
||||||
* Source/NSNotificationCenter.m:
|
* Source/NSNotificationCenter.m:
|
||||||
* Source/NSObject.m:
|
* Source/NSObject.m:
|
||||||
|
* Source/NSSocketPort.m:
|
||||||
* Source/ObjectiveC2/GNUmakefile:
|
* Source/ObjectiveC2/GNUmakefile:
|
||||||
* Source/ObjectiveC2/README:
|
* Source/ObjectiveC2/README:
|
||||||
* Source/ObjectiveC2/weak.m:
|
* Source/ObjectiveC2/weak.m:
|
||||||
|
|
|
@ -1705,8 +1705,9 @@ typedef struct {
|
||||||
{
|
{
|
||||||
NSMapRemove(messagePortMap, (void*)name);
|
NSMapRemove(messagePortMap, (void*)name);
|
||||||
}
|
}
|
||||||
|
[self retain];
|
||||||
M_UNLOCK(messagePortLock);
|
M_UNLOCK(messagePortLock);
|
||||||
[self dealloc];
|
[super release];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -2486,6 +2486,10 @@ static id gs_weak_load(id obj)
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
- (NSUInteger) retainCount
|
||||||
|
{
|
||||||
|
return 0; // So that gs_weak_load() knows the object was deallocated
|
||||||
|
}
|
||||||
- (void) logZombie: (SEL)selector
|
- (void) logZombie: (SEL)selector
|
||||||
{
|
{
|
||||||
GSLogZombie(self, selector);
|
GSLogZombie(self, selector);
|
||||||
|
|
|
@ -2474,8 +2474,9 @@ static Class tcpPortClass;
|
||||||
{
|
{
|
||||||
NSMapRemove(thePorts, host);
|
NSMapRemove(thePorts, host);
|
||||||
}
|
}
|
||||||
|
[self retain];
|
||||||
M_UNLOCK(tcpPortLock);
|
M_UNLOCK(tcpPortLock);
|
||||||
[self dealloc];
|
[super release];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||||
id testObject = nil;
|
id testObject = nil;
|
||||||
|
|
||||||
test_alloc(@"NSConnection");
|
test_alloc(@"NSConnection");
|
||||||
testObject = [NSConnection new];
|
testObject = [NSConnection new];
|
||||||
test_NSObject(@"NSConnection",[NSArray arrayWithObject:testObject]);
|
test_NSObject(@"NSConnection", [NSArray arrayWithObject: testObject]);
|
||||||
testObject = [NSConnection defaultConnection];
|
testObject = [NSConnection defaultConnection];
|
||||||
PASS(testObject != nil && [testObject isKindOfClass:[NSConnection class]],
|
PASS(testObject != nil && [testObject isKindOfClass: [NSConnection class]],
|
||||||
"NSConnection +defaultConnection works");
|
"NSConnection +defaultConnection works");
|
||||||
|
|
||||||
[arp release]; arp = nil;
|
[arp release]; arp = nil;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue