darktable-org/darktable — pull request #403 by TurboGit (2013-12-16 10:07:58+00:00)
Title: [Post-1.4] Never use selected_images in control_jobs (remove/delete).

Indeed between the time we click on delete and the time where the
SQL statements get executed there is a small window where the
user could click on some images and change the selection.

This could even been far more a problem with scripts like Lua.

Instead of using the selected_images table we now properly get the images
to work on from the list associated with the job.

Take the opportunity to refactor some code for better sharing. This fix
an obvious bug where in dt_control_delete_images_job_run we where getting
only the first images for checking for duplicates.

Looks too complex for 1.4 so I have set to Post-1.4 but this fixes a real bug while deleting and a possible race condition but probably difficult to reproduce (except with a script).