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

MIDI for light: Fix unsound timer handling #13117

Merged
merged 6 commits into from
Jul 23, 2024

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Apr 16, 2024

This is a first attempt at fixing #13114.

Maybe someone more familiar with the legacy controller scripting system can comment on this, the timer handling in the script did not look sound, so I tried to ensure that timers are only stopped if they are running and that they are unassigned properly if stopped.

engine.stopTimer(midi_for_light.deck_beat_watchdog_timer[0]);
engine.stopTimer(midi_for_light.deck_beat_watchdog_timer[1]);
engine.stopTimer(midi_for_light.deck_beat_watchdog_timer[2]);
engine.stopTimer(midi_for_light.deck_beat_watchdog_timer[3]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this likely didn't work in the first place. deck_beat_watchdog_timer is a free variable, not a member of midi_for_light. It was probably never noticed being part of the rarely invoked shutdown handler.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error can be reproduced by selecting the MIDI for light mapping and then switching to another mapping (which errors)

fwcd added 5 commits April 17, 2024 18:44
The `[-1, -1]` value is likely taken from other scripts where the
variable actually holds an array of timers. This is not the case here,
so to prevent confusion, we shouldn't use an array where we intend to
assign a timer.
@fwcd fwcd force-pushed the fix-midi-for-light branch from fd9470d to 9cfdbd6 Compare April 17, 2024 16:45
@fwcd fwcd marked this pull request as ready for review April 20, 2024 00:31
@fwcd fwcd changed the title MIDI for light: Fix unsound (?) timer handling MIDI for light: Fix unsound timer handling Apr 20, 2024
This should fix the remaining "Tried to kill non-existent timer" errors.
Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire script is a mess, so LGTM I guess 🤷‍♂️

@fwcd
Copy link
Member Author

fwcd commented Jul 22, 2024

Should this be merged then?

@Swiftb0y
Copy link
Member

Yes

@Swiftb0y Swiftb0y merged commit 3368148 into mixxxdj:2.4 Jul 23, 2024
14 checks passed
@fwcd fwcd deleted the fix-midi-for-light branch July 23, 2024 11:34
@fwcd
Copy link
Member Author

fwcd commented Jul 23, 2024

Ah this still targeted 2.4, so we might need another merge to 2.5

@fwcd fwcd restored the fix-midi-for-light branch July 23, 2024 11:35
@fwcd fwcd deleted the fix-midi-for-light branch July 23, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants