Bug #9698

Image objects are not the same though they are equal in export finalize callback

Added by Attila Gróf about 6 years ago. Updated about 6 years ago.

Start date:
Due date:
% Done:


Estimated time:
Affected Version:
git development version
hardware architecture:


darktable version: 1.3+1459~ge8cd04c

0. Have the following code in luarc
@dt = require "darktable"
local function export_finalize_callback(storage, image_table)

for image, fn in pairs(image_table) do
for i, img in pairs(image:get_group_members()) do
if img == image then
dt.register_storage("proba", "proba callback", nil, export_finalize_callback)

1. Group several images in lighttable
2. Select them and export using 'proba callback' as the target storage

I have grouped 3 images together and got 4 nils as the output (3 numeric indexes + the 'leader' index returned by get_group_members). The image is the index in the table passed to the callback img is taken from the table returned by image:get_group_members().

We refer here to the same images in different 'views':
1. view: the selection of the export
2. view: members of an image group

I expected that these are the same objects. Were these the same object, then the output would be the path of the exported images not nils.

Associated revisions

Revision f6e23530 (diff)
Added by Jérémy Rosen about 6 years ago

lua : rework the way types representing an object with an int id work

this fix bug #9698 where equality wouldn't be true in all case


#1 Updated by Jérémy Rosen about 6 years ago

  • Assignee set to Jérémy Rosen
  • Category changed from Lighttable to Lua

#2 Updated by Jérémy Rosen about 6 years ago

I will have to check, but this one is a complicated one...

I'll fix it before release but it will take different time.

basically you have two lua_image object that represent the same image on the C side of thing
This is supposed to be invisible to you, and the reports the object as being the same...

however when looking into the table, indexing doesn't take into account, so it doesn't work.
I'll have to rework stuff so that it works properly. it's not trivial

#3 Updated by Attila Gróf about 6 years ago

  • Assignee deleted (Jérémy Rosen)

Here is a simple workaround. It is dependent on the fact that the different lua image objects are still equal for '=='.

local function lookup_the_right_image_object(img, exported_images)
  local image, fn
  for image, fn in pairs(exported_images) do
    if img == image then
      return image
  return nil

#4 Updated by Jérémy Rosen about 6 years ago

  • Priority changed from Medium to High
  • Assignee set to Jérémy Rosen

(reassigning to myself, i'm the Lua guy)

thanks for the workaround, it might help anybody looking to avoid the bug...

...but it's still a bug and I will fix it before release.

#5 Updated by Jérémy Rosen about 6 years ago

  • % Done changed from 0 to 50
  • Status changed from New to In Progress

Ok, I fiexed it in trunk, could you confirm that it works for you ?

#6 Updated by Jérémy Rosen about 6 years ago

  • % Done changed from 50 to 100
  • Status changed from In Progress to Fixed

no answer from original submitter, but I was able to reproduce the bug and it is fixed for me.

marking as fixed

Also available in: Atom PDF

Go to top