fix: autostyle deadlock on import and deprecated API removal for Windows#664
Open
2421468125 wants to merge 1 commit intodarktable-org:masterfrom
Open
fix: autostyle deadlock on import and deprecated API removal for Windows#6642421468125 wants to merge 1 commit intodarktable-org:masterfrom
2421468125 wants to merge 1 commit intodarktable-org:masterfrom
Conversation
Problems:
1. Calling darktable.styles.apply() directly inside the
post-import-image callback causes darktable to hang/deadlock.
2. darktable.control.read() has been removed from the Lua API in
recent versions (field "read" not found for type
dt_lua_singleton_control), causing the script to fail on startup.
3. Windows cmd.exe only recognizes double quotes while exiftool_attribute() use single quotes for path.
Fix:
- Wrap the post-import-image callback logic in
darktable.control.dispatch() + darktable.control.sleep(500) so that
style application runs asynchronously in a background thread after
the import pipeline has finished. This avoids the deadlock while
still supporting both single-image and batch imports.
- Remove the darktable.control.read(fd) call from get_stdout().
This function was only used to yield the Lua thread while waiting
for I/O — it did not perform any data reading itself (fd:read('*a')
handles that). Since the entire exiftool call now runs inside a
dispatched background task, blocking the background thread is
acceptable and does not freeze the UI.
- Changed path quoting from single to double quotes.
Tested on darktable 5.4.1 / Windows with Canon CR3 files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems:
Calling darktable.styles.apply() directly inside the post-import-image callback causes darktable to hang/deadlock.
darktable.control.read() has been removed from the Lua API in recent versions (field "read" not found for type dt_lua_singleton_control), causing the script to fail on startup.
Windows cmd.exe only recognizes double quotes while exiftool_attribute() use single quotes for path.
Fix:
Wrap the post-import-image callback logic in darktable.control.dispatch() + darktable.control.sleep(500) so that style application runs asynchronously in a background thread after the import pipeline has finished. This avoids the deadlock while still supporting both single-image and batch imports.
Remove the darktable.control.read(fd) call from get_stdout(). This function was only used to yield the Lua thread while waiting for I/O — it did not perform any data reading itself (fd:read('*a') handles that). Since the entire exiftool call now runs inside a dispatched background task, blocking the background thread is acceptable and does not freeze the UI.
Change path quoting from single to double quotes.
Tested on darktable 5.4.1 / Windows with Canon CR3 files.