mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Fix retain/release problem
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14875 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4c5360c308
commit
9076227a18
1 changed files with 13 additions and 5 deletions
|
@ -559,7 +559,7 @@ gnustep_base_thread_callback()
|
||||||
id receiver;
|
id receiver;
|
||||||
id argument;
|
id argument;
|
||||||
SEL selector;
|
SEL selector;
|
||||||
NSLock *lock;
|
NSLock *lock; // Not retained.
|
||||||
}
|
}
|
||||||
+ (GSPerformHolder*) newForReceiver: (id)r
|
+ (GSPerformHolder*) newForReceiver: (id)r
|
||||||
argument: (id)a
|
argument: (id)a
|
||||||
|
@ -583,7 +583,7 @@ gnustep_base_thread_callback()
|
||||||
h->selector = s;
|
h->selector = s;
|
||||||
if (l != nil)
|
if (l != nil)
|
||||||
{
|
{
|
||||||
h->lock = RETAIN(l);
|
h->lock = l;
|
||||||
[h->lock lock]; // Lock until fire.
|
[h->lock lock]; // Lock until fire.
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
@ -596,15 +596,21 @@ gnustep_base_thread_callback()
|
||||||
if (lock != nil)
|
if (lock != nil)
|
||||||
{
|
{
|
||||||
[lock unlock];
|
[lock unlock];
|
||||||
DESTROY(lock);
|
lock = nil;
|
||||||
}
|
}
|
||||||
NSDeallocateObject(self);
|
NSDeallocateObject(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) fire
|
- (void) fire
|
||||||
{
|
{
|
||||||
|
if (receiver == nil)
|
||||||
|
{
|
||||||
|
return; // Already fired!
|
||||||
|
}
|
||||||
[GSRunLoopForThread(defaultThread) cancelPerformSelectorsWithTarget: self];
|
[GSRunLoopForThread(defaultThread) cancelPerformSelectorsWithTarget: self];
|
||||||
[receiver performSelector: selector withObject: argument];
|
[receiver performSelector: selector withObject: argument];
|
||||||
|
DESTROY(receiver);
|
||||||
|
DESTROY(argument);
|
||||||
if (lock == nil)
|
if (lock == nil)
|
||||||
{
|
{
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
|
@ -612,7 +618,7 @@ gnustep_base_thread_callback()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[lock unlock];
|
[lock unlock];
|
||||||
DESTROY(lock);
|
lock = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -678,8 +684,10 @@ gnustep_base_thread_callback()
|
||||||
if (aFlag == YES)
|
if (aFlag == YES)
|
||||||
{
|
{
|
||||||
[l lockBeforeDate: [NSDate distantFuture]];
|
[l lockBeforeDate: [NSDate distantFuture]];
|
||||||
|
RELEASE(h);
|
||||||
|
[l unlock];
|
||||||
|
RELEASE(l);
|
||||||
}
|
}
|
||||||
RELEASE(h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue