darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.69k stars 1.14k forks source link

Lua register_lib will hang darktable when started in single image (darkroom) mode #5884

Closed wpferguson closed 4 years ago

wpferguson commented 4 years ago

Describe the bug Starting darktable in single image (darkroom) mode with a lua script enabled that uses the register_lib call will cause darktable to hang. With lua debugging enabled the dreaded ERROR in lualib, couldn't find a position for <script name>, this should never happen is displayed.

To Reproduce

  1. Make sure lua scripts are installed
  2. In the luarc file include the line require "official/enfuse"
  3. Start darktable from the command line with darktable -d lua <some image file>
  4. darktable will open in darkroom mode but hang before the image is loaded. The console will display ERROR in lualib, couldn't find a position for enfuse, this should never happen

Expected behavior The image should open in darkroom mode without hanging.

Platform (please complete the following information):

Additional context When register_lib is called it attempts to determine what position to load the module at in the current view instead of the specified view.

This is the root cause of #5840

wpferguson commented 4 years ago

There is a way to recode the script register_lib calls to avoid this problem, by checking the view prior to calling and using the view-changed event to wait for the correct view if necessary. This is lua scripts issue 278.

The Lua API manual needs the register_lib section updated to reflect these changes.

wpferguson commented 4 years ago

Fixed by lua scritps PR 279.