Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when press cmd+z #18110

Closed
pmuntianu opened this issue Dec 29, 2024 · 7 comments
Closed

Segfault when press cmd+z #18110

pmuntianu opened this issue Dec 29, 2024 · 7 comments
Labels
reproduce: confirmed a way to make the bug re-appear 99% of times has been found scope: macos support macos related issues and PR

Comments

@pmuntianu
Copy link

Describe the bug

When I use retouch module and decide to remove the last circle retouch using cmd+z keyboard combination, the app exits

Steps to reproduce

  1. add circle retouch
  2. click cmd+z

Expected behavior

remove the last retouch element

Logfile | Screenshot | Screencast

32.9279 used preset temperature 300 preset='as shot to reference': D65 2.309 1.000 1.531, AS-SHOT 1.864 1.000 1.924
32.9305 used preset temperature 300 preset='as shot to reference': D65 2.309 1.000 1.531, AS-SHOT 1.864 1.000 1.924
32.9325 [dt_dev_read_history_ext] temporary history deleted
32.9325 [dt_iop_reload_defaults] defaults reloaded for filmicrgb
32.9325 [dt_iop_reload_defaults] defaults reloaded for basecurve
32.9325 [dt_iop_reload_defaults] defaults reloaded for colorequal
32.9325 [dt_iop_reload_defaults] defaults reloaded for colormapping
32.9325 [dt_iop_reload_defaults] defaults reloaded for channelmixerrgb
32.9327 [dt_iop_reload_defaults] defaults reloaded for colorin
32.9327 [dt_iop_reload_defaults] defaults reloaded for crop
32.9327 [dt_iop_reload_defaults] defaults reloaded for exposure
32.9327 [dt_iop_reload_defaults] defaults reloaded for retouch
32.9327 [dt_iop_reload_defaults] defaults reloaded for clipping
32.9327 [dt_iop_reload_defaults] defaults reloaded for overlay
32.9327 [dt_iop_reload_defaults] defaults reloaded for flip
32.9327 [dt_iop_reload_defaults] defaults reloaded for ashift
32.9327 [dt_iop_reload_defaults] defaults reloaded for cacorrectrgb
32.9336 [dt_iop_reload_defaults] defaults reloaded for lens
32.9336 [dt_iop_reload_defaults] defaults reloaded for rotatepixels
32.9336 [dt_iop_reload_defaults] defaults reloaded for denoiseprofile
32.9336 [dt_iop_reload_defaults] defaults reloaded for demosaic
32.9336 [dt_iop_reload_defaults] defaults reloaded for rawdenoise
32.9336 [dt_iop_reload_defaults] defaults reloaded for hotpixels
32.9336 [dt_iop_reload_defaults] defaults reloaded for cacorrect
32.9336 [dt_iop_reload_defaults] defaults reloaded for highlights
32.9336 [dt_iop_reload_defaults] scene=YES, modern=YES, CAT=NO. D65 2.309 1.000 1.531, AS-SHOT 1.864 1.000 1.924
32.9337 [dt_iop_reload_defaults] defaults reloaded for temperature
32.9337 [dt_iop_reload_defaults] defaults reloaded for invert
32.9337 [dt_iop_reload_defaults] defaults reloaded for rawprepare
32.9348 [dt_dev_read_history_ext] temporary history initialised with default params and presets
32.9348 [dt_dev_read_history_ext] temporary history merged with image history
32.9348 [history] successfully loaded module rawprepare from history
blendop v. 13: version ok params ok
params v. 2: version ok params ok
32.9348 [history] successfully loaded module demosaic from history
blendop v. 13: version ok params ok
params v. 4: version ok params ok
32.9348 [history] successfully loaded module colorin from history
blendop v. 13: version ok params ok
params v. 7: version ok params ok
32.9348 [history] successfully loaded module colorout from history
blendop v. 13: version ok params ok
params v. 5: version ok params ok
32.9348 [history] successfully loaded module gamma from history
blendop v. 13: version ok params ok
params v. 1: version ok params ok
32.9348 [history] successfully loaded module temperature from history
blendop v. 13: version ok params ok
params v. 4: version ok params ok
32.9348 [history] successfully loaded module highlights from history
blendop v. 13: version ok params ok
params v. 4: version ok params ok
32.9348 [history] successfully loaded module channelmixerrgb from history
blendop v. 13: version ok params ok
params v. 3: version ok params ok
32.9348 [history] successfully loaded module exposure from history
blendop v. 13: version ok params ok
params v. 6: version ok params ok
32.9349 [history] successfully loaded module filmicrgb from history
blendop v. 13: version ok params ok
params v. 6: version ok params ok
32.9349 [history] successfully loaded module flip from history
blendop v. 13: version ok params ok
params v. 2: version ok params ok
32.9349 [history] successfully loaded module lens from history
blendop v. 13: version ok params ok
params v. 10: version ok params ok
32.9349 [history] successfully loaded module highlights from history
blendop v. 13: version ok params ok
params v. 4: version ok params ok
32.9349 [history] successfully loaded module demosaic from history
blendop v. 13: version ok params ok
params v. 4: version ok params ok
32.9349 [history] successfully loaded module denoiseprofile from history
blendop v. 13: version ok params ok
params v. 11: version ok params ok
32.9349 [history] successfully loaded module exposure from history
blendop v. 13: version ok params ok
params v. 6: version ok params ok
32.9349 [history] successfully loaded module toneequal from history
blendop v. 13: version ok params ok
params v. 2: version ok params ok
32.9349 [history] successfully loaded module colorin from history
blendop v. 13: version ok params ok
params v. 7: version ok params ok
32.9349 [history] successfully loaded module channelmixerrgb from history
blendop v. 13: version ok params ok
params v. 3: version ok params ok
32.9349 [history] successfully loaded module colorbalancergb from history
blendop v. 13: version ok params ok
params v. 5: version ok params ok
32.9349 [history] successfully loaded module filmicrgb from history
blendop v. 13: version ok params ok
params v. 6: version ok params ok
32.9349 [history] successfully loaded module retouch from history
blendop v. 13: version ok params ok
params v. 3: version ok params ok
32.9369 used preset temperature 300 preset='as shot to reference': D65 2.309 1.000 1.531, AS-SHOT 1.864 1.000 1.924
[1] 32296 segmentation fault /Applications/darktable.app/Contents/MacOS/darktable -d common

Commit

No response

Where did you obtain darktable from?

downloaded from www.darktable.org

darktable version

5.0

What OS are you using?

Mac

What is the version of your OS?

15.1.1

Describe your system?

No response

Are you using OpenCL GPU in darktable?

None

If yes, what is the GPU card and driver?

No response

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

No response

@MStraeten
Copy link
Collaborator

MStraeten commented Dec 29, 2024

reproduced on macOS with darktable 5.0.0+23~gec82c72acc:
18110.txt

@ralfbrown
Copy link
Collaborator

Works under Linux with current master, so looks like something MacOS-specific (perhaps the Cmd vs Ctrl difference?)

@ralfbrown ralfbrown added reproduce: confirmed a way to make the bug re-appear 99% of times has been found scope: macos support macos related issues and PR labels Dec 29, 2024
@pehar1
Copy link

pehar1 commented Dec 30, 2024

No problems on 5.1.0+19~gf2352efd98, Ubuntu 24.04.

@zisoft
Copy link
Collaborator

zisoft commented Dec 30, 2024

It crashes reproducible in gdk_window_set_cursor(), line 4414 of src/gui/gtk.c:

darktable/src/gui/gtk.c

Lines 4402 to 4422 in 8855ec9

void dt_gui_cursor_clear_busy()
{
// ensure that we have a prior call to set_busy; if not, this call is a no-op
if(busy_nest_count > 0)
{
--busy_nest_count;
if(busy_nest_count == 0 && darktable.gui != NULL)
{
// we've matched the last of the pending set_busy calls, so it is now time
// to restore the original mouse cursor
GtkWidget *toplevel = darktable.gui->ui->main_window;
GdkWindow *window = gtk_widget_get_window(toplevel);
gdk_window_set_cursor(window, busy_prev_cursor);
dt_gui_process_events();
busy_prev_cursor = NULL;
dt_control_allow_change_cursor();
gtk_grab_remove(darktable.control->progress_system.proxy.module->widget);
}
}
}

Bildschirmfoto 2024-12-30 um 13 36 39

But there must be something different in the retouch module. No problems with CMD+Z from other iop modules.

@zisoft
Copy link
Collaborator

zisoft commented Jan 16, 2025

@ralfbrown: The crash is caused by gdk_window_set_cursor(window, busy_prev_cursor). If I replace busy_prev_cursor by NULL the crash is gone.

By reading the documentation of gdk_window_get_cursor():

The returned object is owned by the GdkWindow and should not be unreferenced directly. Use gdk_window_set_cursor() to unset the cursor of the window.

I would assume that the returned object gets invalid by the next call of gdk_window_set_cursor().

@ralfbrown
Copy link
Collaborator

I won't have a chance to test until the weekend, but a g_ref(busy_prev_cursor) after getting should keep it alive. We don't want to force the default cursor when ending the busy cursor, which settting to NULL would produce.

TurboGit added a commit that referenced this issue Jan 16, 2025
Using ralfbrown proposed fix.
@TurboGit
Copy link
Member

@ralfbrown : See #18226. Thanks.

TurboGit added a commit that referenced this issue Jan 17, 2025
Using ralfbrown proposed fix.
esq4 pushed a commit to esq4/darktable that referenced this issue Jan 19, 2025
Using ralfbrown proposed fix.
esq4 added a commit to esq4/darktable that referenced this issue Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reproduce: confirmed a way to make the bug re-appear 99% of times has been found scope: macos support macos related issues and PR
Projects
None yet
Development

No branches or pull requests

6 participants