mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
another bugfix attempt
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36156 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b7368b7c65
commit
98d236617b
3 changed files with 30 additions and 39 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-02-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSAvahiRunLoopIntegration.m: Remove code which was clearing
|
||||
bitmask values needed to track whether watcher needed to be removed
|
||||
from run loop.
|
||||
|
||||
2013-02-16 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSURL.m: a data url ignores any base URL.
|
||||
|
|
|
@ -284,9 +284,7 @@ GSAvahiClientState(AvahiClient *client, AvahiClientState state, void *userInfo)
|
|||
|
||||
- (void) avahiClientDealloc
|
||||
{
|
||||
NSRunLoop *rl = [ctx runLoop];
|
||||
NSString *mode = [[ctx mode] retain];
|
||||
[ctx removeFromRunLoop: rl forMode: mode];
|
||||
[ctx removeFromRunLoop: [ctx runLoop] forMode: [ctx mode]];
|
||||
[self freeClient];
|
||||
[ctx release];
|
||||
[_lock release];
|
||||
|
|
|
@ -165,17 +165,21 @@
|
|||
return;
|
||||
}
|
||||
|
||||
/* FIXME ... in the following switch, as well as setting lastEvent the
|
||||
* code was clearing the corresponding bit in the oldEvents bitmask.
|
||||
* This was causng a crash becasue it meant that we didn't unregister
|
||||
* the event watcher from the run loop before deallocating it and a
|
||||
* new incoming event was sent to the deallocated instance.
|
||||
* I therefore removed that code, but can't see what it was intended
|
||||
* to do.
|
||||
*/
|
||||
switch (type)
|
||||
{
|
||||
case ET_RDESC:
|
||||
lastEvent = AVAHI_WATCH_IN;
|
||||
// Remove the corresponding bit from the event mask:
|
||||
oldEvents = (oldEvents ^ AVAHI_WATCH_IN);
|
||||
break;
|
||||
case ET_WDESC:
|
||||
lastEvent = AVAHI_WATCH_OUT;
|
||||
// Remove the corresponding bit from the event mask:
|
||||
oldEvents = (oldEvents ^ AVAHI_WATCH_OUT);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -494,53 +498,36 @@ GSAvahiTimeoutFree(AvahiTimeout* timeout)
|
|||
- (void)removeFromRunLoop: (NSRunLoop*)rl
|
||||
forMode: (NSString*)m
|
||||
{
|
||||
[lock lock];
|
||||
if ((rl == runLoop) && [mode isEqualToString: m])
|
||||
{
|
||||
[lock lock];
|
||||
//Test again:
|
||||
if ((rl == runLoop) && [mode isEqualToString: m])
|
||||
FOR_IN(GSAvahiWatcher*, child, children)
|
||||
{
|
||||
FOR_IN(GSAvahiWatcher*, child, children)
|
||||
{
|
||||
[child unschedule];
|
||||
}
|
||||
END_FOR_IN(children)
|
||||
runLoop = nil;
|
||||
[mode release];
|
||||
mode = nil;
|
||||
[child unschedule];
|
||||
}
|
||||
[lock unlock];
|
||||
}
|
||||
else
|
||||
{
|
||||
//FIXME: Raise exception?
|
||||
END_FOR_IN(children)
|
||||
runLoop = nil;
|
||||
[mode release];
|
||||
mode = nil;
|
||||
}
|
||||
[lock unlock];
|
||||
}
|
||||
- (void)scheduleInRunLoop: (NSRunLoop*)rl
|
||||
forMode: (NSString*)m
|
||||
{
|
||||
[lock lock];
|
||||
if ((runLoop == nil) && (mode == nil)
|
||||
&& ((rl != nil) && (m != nil)))
|
||||
{
|
||||
[lock lock];
|
||||
//Test again:
|
||||
if ((runLoop == nil) && (mode == nil)
|
||||
&& ((rl != nil) && (m != nil)))
|
||||
runLoop = rl;
|
||||
ASSIGNCOPY(mode,m);
|
||||
FOR_IN(GSAvahiWatcher*, child, children)
|
||||
{
|
||||
runLoop = rl;
|
||||
ASSIGNCOPY(mode,m);
|
||||
FOR_IN(GSAvahiWatcher*, child, children)
|
||||
{
|
||||
[child reschedule];
|
||||
}
|
||||
END_FOR_IN(children)
|
||||
[child reschedule];
|
||||
}
|
||||
[lock unlock];
|
||||
}
|
||||
else
|
||||
{
|
||||
//FIXME: Raise exception.
|
||||
END_FOR_IN(children)
|
||||
}
|
||||
[lock unlock];
|
||||
}
|
||||
|
||||
- (void)release
|
||||
|
|
Loading…
Reference in a new issue