Closed MStraeten closed 2 years ago
What I think could be happening here is that you have a midi knob mapped to a slider in a module with multiple instances in one image and only one instance in the next. When the image is switched (by pressing any of the shortcuts) the extra module instance is deleted (including its widgets) and the target pointer of the slider's action temporarily set to NULL. In a next step, the target will be updated to the currently preferred shortcut instance (which might be first or last) but in the mean time, the midi device polls for an update and tries to access the null pointer.
Probably the below check is the culprit (once again; there've been problems with it before): https://github.com/darktable-org/darktable/blob/4a7774f95d54bebaa05a33b1d7d48b03881031ed/src/gui/accelerators.c#L2910-L2911
Would you please try if merging those two lines to
|| (!action_target && !_widget_invisible(action_target))))
solves the problem? If it does, hopefully it doesn't introduce other bugs...
it solves the problem, but it also doesn't allow to change settings further ;) --> dt shows "not active" So even worse.
both images contains several instances of colorbalancergb which sliders are mapped to the midi device.
fprintf(stderr, "\n%p\n",action_target);
indicates 0x0 --> Nullpointer for the first knob mapped to a colorbalancergb slider.
first occurrence of this issue: https://github.com/darktable-org/darktable/commit/9573128990e429c2890f2f075295a31c77309885 reverting that change prevents the crash
So even worse.
Yeah, sorry, my "fix" was just dumb. Had I been able to test it myself, I would not have wasted your time.
Basically it looks like the fix for #10181, enabling a shortcut for a (ratings) widget that has been deleted, was a bad idea, because now all other widgets can receive shortcuts after being deleted as well.
Can I ask you to test another possible solution for the ratings shortcut malfunction please?
Change
https://github.com/darktable-org/darktable/blob/ec2c49648c569f39775d972a98c8b9df2da1fac0/src/gui/accelerators.c#L3760 to
if(label && action_def && !ac->target) ac->target = widget;
and also revert the "fix" from #10181, i.e. remove https://github.com/darktable-org/darktable/blob/ec2c49648c569f39775d972a98c8b9df2da1fac0/src/gui/accelerators.c#L2910
My intention with this is to solve the problem with the ratings shortcut that the action is initially linked to the stars in the bottom row of lighttable, but then that link is overwritten when thumbnail overlays with stars are also linked to the action. When the thumbnail and its stars get deleted, the action is now linked to a NULL widget. So I'm now hoping that if an action link is not overwritten with a new widget (i.e. it keeps pointing to the original stars/rating widget, which never gets destroyed) it will not get set to NULL.
The risk is that this might also affect the initialisation of multi-instance module widgets, since those used to overwrite the actions of the 1st instance. But I believe that those action->widget pointers get updated each time focus changes, as well as after an image update, so hopefully that will have no impact.
that fixes the crash, enables modification for single instance modules (active and inactive) but not for multi instance modules even these are active after switching to the next image
Are you saying multi-instance only doesn't work "after switching to the next image" or do they never work, even after changing focus between the multi-instances or creating a new instance?
it works fine with multinstance moduels when opening the image coming from lighttable. the switching to the next image result in "not active" for multiinstance modules. Even if i activate one of the instances
And then when you switch focus to a multi-instance module, does it start working again? This probably needs some additional calls to dt_iop_connect_accels_multi to fix, but it would be helpful to know if manually triggering those (by changing the focused module) actually helps, or if this is a completely different problem.
Did the same problem with multi-instance not being enabled after switching images exist before 9573128 ?
my workflow:
if i just revert 9573128 it's fine
addition: if i activate the lowest instance in the stack - rotating the knob is fine. (preference setting is using the last instance) once the lowest instance was activated after switching to a further image there also the lowest instance is changed. After activating a further instance the lowest instance continues to be changed on rotating knobs.
if my XTouch Mini is connected and used for accelerators, switching images in darkroom via space, backspace or selecting an image in the filmstrip. Unfortunately hard to reproduce - if it occurs, then it's reproducible but removing the midi device and attaching this later can be fine for log time. I tried to find a history stack to get a reproducible minimum scenario - but havn't found one...
crash log: darktable-2021-11-14-213335.txt
backtrace
To Reproduce
unfortunately no scenario yet that reproduces the issue each time will do my best to find one ...
Platform