Sparkle during modal dialog in iPhoto

Asked by slandvogt

I want to use Sparkle as update mechanism for my iPhoto Exporter Plugin. The plugin gets loaded when iPhoto displays a modal dialog with the export settings. There seems to be a problem with asynchronous calls to NSURLConnection, when a modal dialog is up (because of some RunLoop issues). I fire up Sparkle in the awakeFromNib method of my Plugin-Controller, but the delegates (e.g. updater:didFinishLoadingsAppcast etc.) get called after (!) the user closed the modal export dialog...

Is there a workaround or special setting I could use?

Question information

Language:
English Edit question
Status:
Answered
For:
Sparkle Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andy Matuschak (andymatuschak) said :
#1

Hm. You've encountered a serious architectural weakness of Sparkle (namely, you can't easily tell it to stop!)

You can use delegate methods to shut down the update, though, when the window is closed.

Revision history for this message
slandvogt (stefan-landvogt) said :
#2

My main problem is, that I dont control the modality of the window: iPhoto does.

Also I dont think that "stopping" is the problem: I really think, that something with NSURLConnection and the RunLoop is causing the problem. It seems that others have the same problem, when they try to send/receive data when a modal dialog is open (e.g. sending a crashreport). There seems to be some workarounds, and I was hoping that Sparkle already had a solution for the issue...

Any ideas how to tackle the problem?

Revision history for this message
slandvogt (stefan-landvogt) said :
#3

Maybe it is possible to have Sparkle running in its own thread totally independent of the main thread or the current running runloop. Is there such possibility?

Revision history for this message
slandvogt (stefan-landvogt) said :
#4

I tried the following:
I create an UpdaterController-Object and call runThread on that in its own thread. In runThread I create an SUUpdater (or subclass) and after creation I let it run in its own runloop in something like the code below:

This works fine but has other problems:
- there is no delegate AFAIK that gets called, when some error happens like host not reachable or something. I see error messages, but the delegate methods are not called
- if an update is available and the Sparkle dialog is shown, then the dialog pops up behind the modal iPhoto exporter dialog and does not react on mouse clicks at all (of course: the exporter dialog is modal...). Also I dont have an handle on the dialog so I could show it modal on top of the export dialog.

So after all I guess that the current Sparkle is not suitable for the environment I am in (iPhoto exporter plugin running while a modal dialog is open) or is there another way (besides extend Sparkle by myself?

Revision history for this message
Hofman (cmhofman) said :
#5

It is not possible to run SUUpdater in another thread. It uses UI, which is not thread safe.

It seems indeed that Sparkle is not the way for your purpose. In fact, I think in your situation the only way an updater could ever work is to launch a separate updater app (which, in fact, could use Sparkle).

Can you help with this problem?

Provide an answer of your own, or ask slandvogt for more information if necessary.

To post a message you must log in.