Skip to main content
C.Cella
Legend
February 28, 2026
Answered

Modal Progress Scope(s) created by SDK lingers on even when done

  • February 28, 2026
  • 3 replies
  • 57 views

Modal progress Scopes created by SDK stay visible EVEN when they are done.

The modal scope can’t be cancelled, it stays there unless I restart LrC

I see this with my own plug-ins but also ​@johnrellis (that I use for the video example)
 

Usually the task running within/under the scope is completed safely BUT still the bug is problematic.

 

    Correct answer johnrellis

    There’s a very old bug (2009!) where modal progress scopes don’t close after calling scope:done():

    https://community.adobe.com/questions-675/lrdialogs-showmodalprogressdialog-does-not-hide-on-completion-949577?sort=oldestFirst#comments

     

    The workaround provided by the Adobe employee is to call LrTasks.sleep (0) after calling scope:done() and exiting the function context, e.g.

    LrFunctionContext.callWithContext ("", function (context)
        local scope = LrDialogs.showModalProgressDialog (...)
        <do the work>
        scope:done ()
        end)
    LrTasks.sleep (0) -- SDK bug: force the scope to close

     

    Many of my plugins use this workaround, except that they call LrTasks.sleep (0.05). Years ago I found that was more reliable, but I have no idea if that’s still true.

     

    I see that Any Tag’s Tag command (shown in your screen recording) calls LrTasks.yield() instead of sleep (0.05) (it was my first released plugin).  When I run Tag, the scope disappears correctly on my LR (see the attached screen recording), but not on your installation.  Try version 1.21.1, which calls sleep (0.05):

    https://www.dropbox.com/scl/fi/g0euy7fxt5942ctlj80iy/anytag.1.21.1.zip?rlkey=w54vy09j9twjo6f6nq2wa8uxn&dl=0

     

    Re the Cancel button in Tag’s scope, I see that the code never calls scope:isCanceled(). I’ve added that bug to Any Tag’s bug list.  But that shouldn’t affect whether or not the scope disappears.

    3 replies

    johnrellis
    Legend
    March 1, 2026

    It took me 45 minutes to get this reply pasted due to a shameful, trivial bug in the forum platform:

     

    johnrellis
    johnrellisCorrect answer
    Legend
    March 1, 2026

    There’s a very old bug (2009!) where modal progress scopes don’t close after calling scope:done():

    https://community.adobe.com/questions-675/lrdialogs-showmodalprogressdialog-does-not-hide-on-completion-949577?sort=oldestFirst#comments

     

    The workaround provided by the Adobe employee is to call LrTasks.sleep (0) after calling scope:done() and exiting the function context, e.g.

    LrFunctionContext.callWithContext ("", function (context)
        local scope = LrDialogs.showModalProgressDialog (...)
        <do the work>
        scope:done ()
        end)
    LrTasks.sleep (0) -- SDK bug: force the scope to close

     

    Many of my plugins use this workaround, except that they call LrTasks.sleep (0.05). Years ago I found that was more reliable, but I have no idea if that’s still true.

     

    I see that Any Tag’s Tag command (shown in your screen recording) calls LrTasks.yield() instead of sleep (0.05) (it was my first released plugin).  When I run Tag, the scope disappears correctly on my LR (see the attached screen recording), but not on your installation.  Try version 1.21.1, which calls sleep (0.05):

    https://www.dropbox.com/scl/fi/g0euy7fxt5942ctlj80iy/anytag.1.21.1.zip?rlkey=w54vy09j9twjo6f6nq2wa8uxn&dl=0

     

    Re the Cancel button in Tag’s scope, I see that the code never calls scope:isCanceled(). I’ve added that bug to Any Tag’s bug list.  But that shouldn’t affect whether or not the scope disappears.

    C.Cella
    C.CellaAuthor
    Legend
    March 1, 2026

    Thanks John.

    I will add a LrTasks.sleep() at the end in my codes as well.

    Fwiw the forum platform did not suggest/find that 2009 thread as I typed the title of for this thread.

    johnrellis
    Legend
    March 1, 2026

    <deleted>