Skip to content

Fix infinite loop crash when Levels Gamma is set to 0#2041

Open
levanel wants to merge 1 commit intoPintaProject:masterfrom
levanel:fix-levels-crash
Open

Fix infinite loop crash when Levels Gamma is set to 0#2041
levanel wants to merge 1 commit intoPintaProject:masterfrom
levanel:fix-levels-crash

Conversation

@levanel
Copy link

@levanel levanel commented Mar 14, 2026

Fixes #2035

Description
This PR fixes a bug where the application permanently freezes if the user drags the gamma (midtones) slider down to 0.

The freeze was caused by an infinite do-while loop in {UpdateGammaByMask(float val)}. The UI allows the user to request a value of 0 , but the underlying engine strictly clamps Gamma to a minimum of 0.1 . Because the target value could never be reached, the loop never exited locking up the main thread.

Changes
Added 'val = Math.Clamp(val, 0.1f, 10.0f);' at the start of {UpdateGammaByMask} in Effects.LevelsDialog.cs to ensure the requested value matches the physical limits before the loop begins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Pinta freezes completely when holding the '-' button to bring Levels Gamma down to 0

1 participant