ptz-controls: auto-save config + clamp preset_max#323
Open
EdueskaWeiz wants to merge 2 commits into
Open
Conversation
added 2 commits
June 26, 2026 16:46
The plugin only writes its configuration on a clean shutdown, when the OBS_FRONTEND_EVENT_EXIT event fires. If OBS crashes or is killed, any changes made during the session - new presets, renamed devices, joystick and live-move settings - are lost. Add a 30 second auto-save timer that calls SaveConfig() whenever the configuration has been modified. To avoid scattering dirty-tracking calls throughout every setter, the dirty flag is raised from a single slot, markConfigDirty(), wired up centrally in the constructor to the existing change signals (PTZDevice::settingsChanged and the autoselect / live-move / speed-ramp toggles). The timer only touches the disk when something actually changed, and loading the configuration at startup is explicitly excluded from marking it dirty. Signed-off-by: Eddy Weiz <eddyweiz@gmail.com>
The preset limit is read straight from the configuration and cast to size_t before being handed to PTZPresetModel. A corrupt or hand-edited config could hold a negative or absurdly large value, which after the cast to size_t would result in a huge preset count. Clamp the value to the same 1..128 range that the properties slider already enforces. Signed-off-by: Eddy Weiz <eddyweiz@gmail.com>
Owner
|
Have you run tested this PR? |
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.
Reworked from #302 per your review.
Both commits are clang-format clean and carry a DCO Signed-off-by line. The crash/threading change is intentionally left out since you reverted that approach, and the custom config backup is dropped as redundant with the existing obs_data_*_safe("bak") mechanism.