Skip to content

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 requested review from caarlos0 and muesli July 28, 2023 16:19
@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

3 participants