Skip to content

fix UI deadlocks + improve visual word colors#26

Open
cortze wants to merge 1 commit intomainfrom
feature/ui-refactor
Open

fix UI deadlocks + improve visual word colors#26
cortze wants to merge 1 commit intomainfrom
feature/ui-refactor

Conversation

@cortze
Copy link
Collaborator

@cortze cortze commented May 8, 2022

Fixed problem with the terminal manager (tview) that was freezing the entire UI.

Added a flag that restricts printing debug messages in the console until the UI is initialized.

NOTE: We can play alone even if we don't have any peers connected, we should take a look at it (the user can achieve a longer word count by playing in localhost and then connecting to the network)

@cortze cortze requested review from Wondertan and ajnavarro May 8, 2022 23:30
Comment on lines +114 to +118
go func() {
// mark as initialized after ~200 milliseconds
time.Sleep(200 * time.Millisecond)
*initialized = true
}()
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, basing initialization on a timer is not a good idea in my opinion. You should have someplace in your code where you are sure everything is initialized.

Comment on lines +37 to +40
// wait untill UI is initialilzed
for !ui.uiInitialized {
time.Sleep(200 * time.Millisecond)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of doing this, you can call SetLog when you know you can do it (UI is initialized) from the parent class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants