On Sep 04, 2008, at 16:10:52, dwt wrote:
>> Every time that notification arrives, GAB sends [delegate
>> growlIsReady], if the delegate responds to it, and then removes one
>> notification handler.
>
> Which means that the second one (if it should come at all) will be
> discarded.
No it doesn't. The notification observer method removes *one*
notification observer. The other observer remains until the method is
called the second time.
>> If -growlIsReady is not safe to call twice (and we can't assume
>> that it is), then this can result in unpredictable problems.
>
> But we can check and don't need to assume, right?
Err, no. There is no way to know whether a method is safe to call twice.
> So:
> * Calling setGrowlDelegate: needs to be safe to call multiple times
> anyway because it's clients might
Right. The problem is calling it multiple times without running the
run loop. Like this:
[GAB setGrowlDelegate:foo];
[GAB setGrowlDelegate:bar];
I can't think of a reason why an application would do that. Most
applications that call +setGrowlDelegate: more than once—if there are
any—will call it in response to a user event, meaning that the run
loop will run in between calls.
What you're proposing is this:
[GAB
(inside +initialize…)
[GAB setGrowlDelegate:nil];
setGrowlDelegate:foo];
This, too, sends setGrowlDelegate: twice without running the run loop
in between. That means no chance for the GROWL_IS_READY notification
to arrive before the second setGrowlDelegate: message.
> * Calling setGrowlDelegate: multiple times is safe - because the
> critical behaviour - talking to the daemon[ -] happens via
> DistributedNotifications - where this behaviour is specified and
> safe as documented.
GAB's message to GHA is in the form of launching it with
a .growlRegDict file. Only GHA's response comes in the form of a DNC
notification.
Launching multiple files is safe, as is launching the same file
multiple times. I'm not sure about distributed notifications, however.
> I'm asking this because I like about this solution that it is very
> simple - and it also gives a preset from which refactoring can pursue.
I have much more ambitious plans for a new API in my head (which we
will not implement for quite some time because we have more immediate
things to tackle). I may write them down during my flight tomorrow.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Growl Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/growldiscuss?hl=en
-~----------~----~----~----~------~----~------~--~---