Skip navigation
ckhorne
Currently Being Moderated

How to control shutdown in > 3.0?

Mar 23, 2012 2:32 PM

Tags: #lrshutdown

I'm trying to cleanup properly when my plugin is finished running. This worked fine up through LR 3.0, but Im looking into why it's not working now (under 3.6 or 4.0).

 

I checked the SDK and found that the LrShutdownPlugin states "Ignored in any Lightroom version older than 3.0"

 

LrDisablePlugin works, but isn't called when Lightroom is being closed.

 

Does anyone have a solution? The only hack I can come up with is to have some kind of activity timeout, but that's going to be tough to implement with my current architecture...

 
Replies
  • Currently Being Moderated
    Mar 23, 2012 3:58 PM   in reply to ckhorne

    I don't fully understand the problem yet - is LrShutdownPlugin not being called in Lr4.0?

     

    For me, LrShutdownPlugin just sets a global flag, then that flag is always checked in loops and background tasks...

     

    I haven't specifically checked whether it's working in Lr4.0, or whether the behavior has changed, nor have I noticed any problems specifically having to do with that, although I have had some strange problems that maybe could have to do with that.

     

    Rob

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 24, 2012 3:53 PM   in reply to ckhorne

    Hi,

     

    I'm pretty sure both LrShutdownPlugin and LrDisablePlugin were introduced

    no earlier than LR 3.0 so if your problem is with LR 2.x then these won't

    help you.

     

    It sounds like you have problems with both LR 3.x and 4.x. I'm assuming the

    problem is with shutdown detection rather than certain functions failing to

    work during shutdown? Correct?  It is possible that certain features may

    have difficulty (e.g. writing to the catalog) depending on how late they

    are called in the shutdown process. As an extreme example if my task

    detected shutdown, slept for 60 seconds then tried to update photo metadata

    I'd be surprised if it worked.

     

    Thanks,

    Matt

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2012 12:55 PM   in reply to ckhorne

    LrShutdownPlugin is supposed to be the name of a .lua file. But it only gets invoked when you hit Reload in the Plug-in Manager, not when Lightroom shuts down:

     

    http://forums.adobe.com/message/2926906#2926906

     

    I just verified the same behavior in LR 4.0.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2012 5:29 PM   in reply to John R. Ellis

    I'm glad someone verified this, as the docs are pretty unclear about the difference (if there is any) on how to use LrShutdownPlugin and LrInitPlugin. One is the name of a script, and the other is a function. Shifting language like this, with a language where functions are first-class objects that can be passed around as params, is a recipe for confusion.

     

    So, LrShutdownPlugin is called when the plugin is shutdown "for any reason". Well, other than the app shutting down. Which sort of makes sense -- we certainly don't want the app to be hung on shutdown because of a bad plugin, possibly one that has some handle to the DB open.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2012 6:11 AM   in reply to ckhorne

    A plug-in keeping the app from cyling is particularly bad -- it is the last recourse for users trying to fix intractible problems. Anything that increases the number of force quits is not a good strategy. It is very common to to restrict activity like this on shutdown.

     

    I'm not saying this is on purpose, but it does make sense in an environment where you have to balance convenience (API access by third-parties) with safety. It might just be an oversight on Adobe's part.

     

    LrDisablePlugin is a hook into the plug-in manager to know when the disable button has been activated. This is different from LrShutdownPlugin, which can happen for a variety of reasons, only some of which are user-activated. I suspect that if you made a plug-in that failed sometime after being enabled (say, by hooking into the extras menu and forcing a failure) LrShutdownPlugin might be called as a last resort. If my guess that it is sort of a final block is correct.

     

    I'll add this to the scenarios I'd like to check.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points