mirror of
https://github.com/MonitorControl/MonitorControl.git
synced 2026-10-29 22:00:50 -06:00
[PR #1932] Fix crash on NaN DDC value after display reconfiguration #1341
Labels
No labels
Status: Abandoned
arm64
beta
beta
bug
done
duplicate
enhancement
feedback needed from reporter
in progress
information
invalid
investigating
known Issue
monitor Issue
pull-request
translation
unable to reproduce
unreleased
x86
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/MonitorControl#1341
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MonitorControl/MonitorControl/pull/1932
Author: @Bouke
Created: 10/27/2026
Status: 🔄 Open
Base:
main← Head:fix/nan-ddc-value-crash📝 Commits (1)
9906864Store maxDDC before converting the read DDC value📊 Changes
2 files changed (+10 additions, -4 deletions)
View changed files
📝
MonitorControl/Model/Display.swift(+1 -1)📝
MonitorControl/Model/OtherDisplay.swift(+9 -3)📄 Description
When a display shows up under a new prefs id (after wake or re-docking, for example),
setupCurrentAndMaxValuesconverts the DDC value it just read beforemaxDDCis stored. With min and max both 0,convDDCToValuedivides 0 by 0 and the NaN gets saved as the current value. The next brightness change then traps onUInt16(NaN)inconvValueToDDC; themin/maxclamps don't help, as they pass NaN through.This PR stores
maxDDCbefore converting the read value. A display that reports a maximum of 0 falls back toDDC_MAX_DETECT_LIMIT(I've seen an iiyama do this for volume over HDMI), and a NaN that earlier versions already saved is removed, so the value is read again.I reproduced it on 4.4.0 by removing the
maxDDCkeys from the prefs: every command loggedCurrent internal value: nanand the next brightness key press crashed. With this change the same steps give valid values. Probably the same crash as #1919. #1874 also guards against min == max in the conversions, but doesn't cover the ordering or the NaN values already in people's prefs.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.