Sweet.
My hunch is that NSURLConnection is relying on Carbon Events
(or something similar) under the hood, and those carbon events
are not getting serviced when the run loop is in the modal
dialog mode. This hack causes NSEvent to post periodic events
to the run loop, which somehow tickles it into processing the
Carbon Events too.
The main problem with this is that calls to [NSEvent
startPeriodicEventsAfterDelay:withPeriod:] don't nest. If you
try to call it a second time, it throws a Obj-C exception.
You could catch that exception, and store a flag to know if
you need to call [NSEvent stopPeriodicEvents], but there are
other issues (see below).
Note that there is no [NSEvent periodicEventsActive], so it's
impossible to know whether you need to call
'startPeriodicEventsAfterDelay' at any point.
However, Cocoa also wants to call 'startPeriodicEventsAfterDelay'
in places unbeknownst to you (e.g. when you drag over a text field).
If you've turned on periodic events, these will throw exceptions,
and functionality will break.
I don't have a good alternative solution. I worked around this
problem in my codebase by replacing my carbon events with
CFMessage code, but you don't have that luxury for NSURLConnection.
Perhaps (with an ADC incident?) you could find out what
[NSEvent startPeriodicEventsAfterDelay:] does, and emulate that?
Simon
Mark Thomas wrote on 25/6/04, 3:16 pm:
> Ok, that works, Why do you not recommending shipping with anything
> like this, I know testing needs to be done.
>
> Is there something that bad with this ???, as seems to work great.
>
> Thanks Mark.
>
> > Message: 8
> > Date: Thu, 24 Jun 2004 12:53:50 -0700 (PDT)
> > From: email@hidden (Simon Fraser)
> > Subject: Re: Modal control
> > To: email@hidden
> > cc: "Darin Adler" <email@hidden>, "Apple WebKit List"
> > <email@hidden>
> > Organization: AOL
> >
> > Mark Thomas wrote on 24/6/04, 12:41 pm:
> >
> >> Ok, like the sound of this :-), so do you mean
> >>
> >> [NSEvent startPeriodicEventsAfterDelay:0 withPeriod:0.2]
> >>
> >> [NSApp runModalForWindow: myWindow ]
> >>
> >> [NSEvent startPeriodicEventsAfterDelay:0 withPeriod:0 ]
> >
> > You want
> >
> > [NSEvent stopPeriodicEvents] here.
> >
> >> And that's all, or do I need to some extra trickery
> >
> > That might be all. No guarantees that it will work, but try it.
> >
> > Also, note that it's a hack and can cause other issues. I'd not
> > recommend shipping anything using this. The point is that it
> > shows (if it works) that there may be ways to tickle the run
> > loop to make NSURLConnection happy.
> >
> > Simon
> _______________________________________________
> webkitsdk-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webkitsdk-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webkitsdk-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webkitsdk-dev
Do not post admin requests to the list. They will be ignored.