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

Open
wants to merge 6 commits into
base: 2.4
Choose a base branch
from

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)

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 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.
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.

None yet

1 participant