Skip to content

Fixing unsafe read&write of g->data - #22365

Open
jenshannoschwalm wants to merge 1 commit into
darktable-org:masterfrom
jenshannoschwalm:highlights_gui_critical
Open

jenshannoschwalm wants to merge 1 commit into
darktable-org:masterfrom
jenshannoschwalm:highlights_gui_critical

Conversation

@jenshannoschwalm

@jenshannoschwalm jenshannoschwalm commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes (1) use of dt_iop_gui_enter/leave_critical_section

As analysed in #22064
A widget callback on the GTK main thread writes GUI state that controls a module's mask display — the toggle that makes the module show its internal mask instead of the image and in one case the mask channel.
That toggle selects - and in process() / process_cl() reads - that same field on a pixelpipe worker thread.
We must synchronize the two threads by guarding via dt_iop_gui_enter/leave_critical_section(), fixes have been done for demosaic, highlights and toneequalizer.

Note for devs: Since e417e94 iop_module->gui_lock is recursive!

  • I have read CONTRIBUTING.md and the coding style.
  • I have not merged master into the topic branch.
  • The pull request is one logical change, and every commit compiles on its own.
  • I ran the relevant tests: unit tests, src/tests/integration/ where the pixelpipe is touched, or darktable-cli as a headless smoke test.
  • New user-visible strings use _(), new preferences are registered in data/darktableconfig.xml.in.
  • A RELEASE_NOTES.md is not required

@jenshannoschwalm jenshannoschwalm added this to the 5.8 milestone Sep 22, 2026
@jenshannoschwalm jenshannoschwalm added bugfix pull request fixing a bug priority: low core features work as expected, only secondary/optional features don't scope: codebase making darktable source code easier to manage labels Sep 22, 2026
@jenshannoschwalm
jenshannoschwalm marked this pull request as draft September 23, 2026 03:55
@jenshannoschwalm jenshannoschwalm changed the title Highlights critical gui fixes Fixing unsafe read&write of g->data Sep 23, 2026
A widget callback on the GTK main thread writes GUI state that controls a module's mask
display — the toggle that makes the module show its internal mask instead of the image
and in one case the mask channel.
That toggle selects — and in process() / process_cl() reads -  that same field on a
pixelpipe worker thread.
We must synchronize the two threads by guarding via dt_iop_gui_enter_critical_section(),
fixes have been done for demosaic, highlights and toneequalizer.

Note for devs: Since e417e94 iop_module->gui_lock is recursive!
@jenshannoschwalm
jenshannoschwalm marked this pull request as ready for review September 23, 2026 05:00
@jenshannoschwalm jenshannoschwalm removed the priority: low core features work as expected, only secondary/optional features don't label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug scope: codebase making darktable source code easier to manage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant