mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Avahi bugfixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31492 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
092e9227b5
commit
bdaf339b92
2 changed files with 26 additions and 12 deletions
|
@ -1,3 +1,10 @@
|
|||
2010-10-08 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSAvahiRunLoopIntegration.m: Fix some bugs:
|
||||
- Remove an extra retain of the NSTimer which was leaking memory.
|
||||
- When passed a NULL struct timeval * from avahi, invalidate
|
||||
the timer and don't schedule a new one.
|
||||
|
||||
2010-10-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPredicate.m: Add simple implementation of
|
||||
|
|
|
@ -222,26 +222,33 @@
|
|||
timer = nil;
|
||||
}
|
||||
|
||||
timer = [[NSTimer timerWithTimeInterval: interval
|
||||
target: self
|
||||
selector: @selector(didTimeout:)
|
||||
userInfo: nil
|
||||
repeats: NO] retain];
|
||||
// NOTE: the timer ivar is a weak reference; runloops retain their
|
||||
// timers.
|
||||
timer = [NSTimer timerWithTimeInterval: interval
|
||||
target: self
|
||||
selector: @selector(didTimeout:)
|
||||
userInfo: nil
|
||||
repeats: NO];
|
||||
[[ctx runLoop] addTimer: timer
|
||||
forMode: [ctx mode]];
|
||||
}
|
||||
|
||||
- (void)setTimerToTimeval: (const struct timeval*)tv
|
||||
{
|
||||
// Construct a NSTimeInterval for the timer:
|
||||
NSTimeInterval interval = 0;
|
||||
// Invalidate the old timer
|
||||
if (timer != nil)
|
||||
{
|
||||
[timer invalidate];
|
||||
timer = nil;
|
||||
}
|
||||
|
||||
if (NULL != tv)
|
||||
{
|
||||
interval = (NSTimeInterval)tv->tv_sec;
|
||||
// Construct a NSTimeInterval for the timer:
|
||||
NSTimeInterval interval = (NSTimeInterval)tv->tv_sec;
|
||||
interval += (NSTimeInterval)(tv->tv_usec / 1000000.0);
|
||||
[self setTimerToInterval: interval];
|
||||
}
|
||||
[self setTimerToInterval: interval];
|
||||
}
|
||||
- (id)initWithCallback: (AvahiTimeoutCallback)aCallback
|
||||
andContext: (GSAvahiRunLoopContext*)aCtx
|
||||
|
@ -264,8 +271,8 @@
|
|||
{
|
||||
if ([timer isValid])
|
||||
{
|
||||
[timer invalidate];
|
||||
fireDate = [[timer fireDate] retain];
|
||||
[timer invalidate];
|
||||
timer = nil;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue