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

Clean up some async race conditions & CSS fixes #930

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented Jun 19, 2024

The dialogs are now asynchronous as opposed to the browser built-in ones that are synchronous, probably because they are incredibly old. The problem with the new dialogs being asynchronous is that for example the hotkeys, the server protocol and honestly any sort of async download that's still running in the background can all mess with the timer while the dialog is open. This could lead to all sorts of weird issues, like the timer being in a different state than what the dialog expects, the timer being reset twice and creating two dialogs that are open at the same time and possibly even memory corruption in the Rust code.

This commit ensures that the timer can not be interacted with while it is "locked for interaction". In fact we already had such a notion where when you navigate to the settings, layout or run editor, the hotkeys would be disabled. Now this is concept is extended so the event sink also can prevent interaction with the timer. Navigating to these menus and opening dialogs will now trigger this locking mechanism.

Additionally this improves various async race conditions in the splits editor related to downloading resources from speedrun.com or splits.io.

This also touches the CSS of the dialogs again, adding some spacing around the dialog, so it doesn't touch the edges of the window and allowing the buttons to have more dynamic sizing. In particular I've noticed that the text sometimes doesn't fit into the buttons on iOS, so they are now allowed to grow a little to handle that situation.

File open dialogs also now know the file extensions of the files we are looking for.

The dialogs are now asynchronous as opposed to the browser built-in ones
that are synchronous, probably because they are incredibly old. The
problem with the new dialogs being asynchronous is that for example the
hotkeys, the server protocol and honestly any sort of async download
that's still running in the background can all mess with the timer while
the dialog is open. This could lead to all sorts of weird issues, like
the timer being in a different state than what the dialog expects, the
timer being reset twice and creating two dialogs that are open at the
same time and possibly even memory corruption in the Rust code.

This commit ensures that the timer can not be interacted with while it
is "locked for interaction". In fact we already had such a notion where
when you navigate to the settings, layout or run editor, the hotkeys
would be disabled. Now this is concept is extended so the event sink
also can prevent interaction with the timer. Navigating to these menus
and opening dialogs will now trigger this locking mechanism.

Additionally this improves various async race conditions in the splits
editor related to downloading resources from speedrun.com or splits.io.

This also touches the CSS of the dialogs again, adding some spacing
around the dialog, so it doesn't touch the edges of the window and
allowing the buttons to have more dynamic sizing. In particular I've
noticed that the text sometimes doesn't fit into the buttons on iOS, so
they are now allowed to grow a little to handle that situation.
@CryZe CryZe added bug There's a bug in LiveSplit One. enhancement A new feature or general improvement to LiveSplit One. iOS An issue that affects iOS. UI The issue is about the user interface. high priority This is a high priority issue. labels Jun 19, 2024
@CryZe CryZe merged commit 9f3ed50 into LiveSplit:master Jun 19, 2024
1 check passed
@CryZe CryZe deleted the async-cleanup branch June 19, 2024 17:47
@CryZe CryZe added the WebKit An issue that affects the WebKit engine (used by Safari and Tauri on Linux) label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug There's a bug in LiveSplit One. enhancement A new feature or general improvement to LiveSplit One. high priority This is a high priority issue. iOS An issue that affects iOS. UI The issue is about the user interface. WebKit An issue that affects the WebKit engine (used by Safari and Tauri on Linux)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant