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

fix!: output race condition #146

Open
wants to merge 1 commit into
base: cache-profile
Choose a base branch
from
Open

fix!: output race condition #146

wants to merge 1 commit into from

Conversation

aymanbagabas
Copy link
Collaborator

@aymanbagabas aymanbagabas commented Jul 28, 2023

BREAKING!

Use a mutex to guard setting/getting the color profile and fg/bg colors.
Use SetColorProfile to change the output color profile.
Use pointer receiver since we have a lock in the struct.

Fixes: charmbracelet/lipgloss#210
Fixes: #145
Fixes: charmbracelet/log#67

@aymanbagabas aymanbagabas force-pushed the race-fix branch 2 times, most recently from de1ed94 to 3cf3563 Compare July 28, 2023 16:45
@aymanbagabas aymanbagabas changed the title fix: output race condition fix!: output race condition Jul 28, 2023
aymanbagabas added a commit to charmbracelet/lipgloss that referenced this pull request Jul 28, 2023
Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the color profile causing a race condition.

Needs: muesli/termenv#146
@aymanbagabas aymanbagabas force-pushed the race-fix branch 2 times, most recently from c0b676e to 3c898b2 Compare July 28, 2023 17:16
aymanbagabas added a commit to charmbracelet/lipgloss that referenced this pull request Jul 28, 2023
Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the color profile causing a race condition.

Needs: muesli/termenv#146
aymanbagabas added a commit to charmbracelet/lipgloss that referenced this pull request Jul 28, 2023
Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the dark background color causing a race condition.

Needs: muesli/termenv#146
aymanbagabas added a commit to charmbracelet/lipgloss that referenced this pull request Jul 28, 2023
Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the dark background color causing a race condition.

Needs: muesli/termenv#146
aymanbagabas added a commit to charmbracelet/lipgloss that referenced this pull request Jul 28, 2023
Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the dark background color causing a race condition.

Needs: muesli/termenv#146
@aymanbagabas aymanbagabas changed the base branch from master to cache-profile July 28, 2023 19:10
Use a mutex to guard setting/getting the color profile and fg/bg colors.
Use `SetColorProfile` to change the output color profile.
Use pointer receiver since we have a lock in the struct.

Fixes: charmbracelet/lipgloss#210
Fixes: #145
aymanbagabas added a commit to charmbracelet/lipgloss that referenced this pull request Aug 1, 2023
Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the dark background color causing a race condition.

Needs: muesli/termenv#146
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.

Data race Data race
2 participants