mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
6cf363efd5
commit
a7d93276b9
1 changed files with 13 additions and 5 deletions
|
@ -559,7 +559,7 @@ gnustep_base_thread_callback()
|
|||
id receiver;
|
||||
id argument;
|
||||
SEL selector;
|
||||
NSLock *lock;
|
||||
NSLock *lock; // Not retained.
|
||||
}
|
||||
+ (GSPerformHolder*) newForReceiver: (id)r
|
||||
argument: (id)a
|
||||
|
@ -583,7 +583,7 @@ gnustep_base_thread_callback()
|
|||
h->selector = s;
|
||||
if (l != nil)
|
||||
{
|
||||
h->lock = RETAIN(l);
|
||||
h->lock = l;
|
||||
[h->lock lock]; // Lock until fire.
|
||||
}
|
||||
return h;
|
||||
|
@ -596,15 +596,21 @@ gnustep_base_thread_callback()
|
|||
if (lock != nil)
|
||||
{
|
||||
[lock unlock];
|
||||
DESTROY(lock);
|
||||
lock = nil;
|
||||
}
|
||||
NSDeallocateObject(self);
|
||||
}
|
||||
|
||||
- (void) fire
|
||||
{
|
||||
if (receiver == nil)
|
||||
{
|
||||
return; // Already fired!
|
||||
}
|
||||
[GSRunLoopForThread(defaultThread) cancelPerformSelectorsWithTarget: self];
|
||||
[receiver performSelector: selector withObject: argument];
|
||||
DESTROY(receiver);
|
||||
DESTROY(argument);
|
||||
if (lock == nil)
|
||||
{
|
||||
RELEASE(self);
|
||||
|
@ -612,7 +618,7 @@ gnustep_base_thread_callback()
|
|||
else
|
||||
{
|
||||
[lock unlock];
|
||||
DESTROY(lock);
|
||||
lock = nil;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
@ -678,8 +684,10 @@ gnustep_base_thread_callback()
|
|||
if (aFlag == YES)
|
||||
{
|
||||
[l lockBeforeDate: [NSDate distantFuture]];
|
||||
RELEASE(h);
|
||||
[l unlock];
|
||||
RELEASE(l);
|
||||
}
|
||||
RELEASE(h);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue