Fixes crash on pinned window followed by darkroom navigation - #22096
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash that occurs when pinning an image in the second darkroom window and navigating images in the main view, and hardens viewport dimension calculations against division-by-zero during image transitions.
Problem & Root Cause
In GTK 3, the
GtkGesture::beginandGtkGesture::endsignals pass three arguments:(GtkGesture *gesture, GdkEventSequence *sequence, gpointer user_data).The callback handlers omitted the
sequenceparameter ((GtkGestureZoom *gesture, gpointer user_data)). For touchpad gestures, GTK emits aNULLsequence; on ARM64, this placed0x0into the second argument register (x1), causing the callback to receivedev = NULL. Accessingdev->preview2_pinned(at offset0xba0indt_develop_t) caused an immediate null pointer dereference.During image switches while second window callbacks are active,
dt_dev_get_processed_sizecould return 0 for width/height before pipeline nodes are ready. Calling functions (dt_dev_get_zoom_scale,_dev_zoom_move,dt_dev_get_pointer_zoom_pos) did not guard againstprocw <= 0orproch <= 0, leading to potential division by zero /inf/NaN.dt_dev_get_processed_sizealways fell back todarktable.develop->preview_pipeinstead of checkingport->dev->preview_pipewhen dealing with a pinned develop instance.Changes
src/gui/gtk.c:_pinch_beginand_pinch_endcallback signatures to includeGdkEventSequence *sequence.src/views/darkroom.c:!devchecks across all second-window event callbacks (_second_window_pinch, button pressed/released, pan, mouse moved, touch moved, leave).src/develop/develop.c:dt_dev_get_processed_sizefallback to respectport->devwhen available.procw <= 0,proch <= 0, andscale <= 0.0findt_dev_get_zoom_scale,_dev_zoom_move, anddt_dev_get_pointer_zoom_pos/dt_dev_get_pointer_zoom_pos_from_bounds.Verification seqeuence
Space/Backspace).Crash report
crash_report.txt
Co-authored with Gemini.