Skip to content

Commit

Permalink
use right lock
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Apr 11, 2024
1 parent 3dd88ac commit a65b4dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions widget/richtext.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ func (t *RichText) cachedSegmentVisual(seg RichTextSegment, offset int) fyne.Can
}

func (t *RichText) cleanVisualCache() {
t.cacheLock.Lock()
defer t.cacheLock.Unlock()
if len(t.visualCache) <= len(t.Segments) {
return
}
Expand Down Expand Up @@ -736,9 +738,7 @@ func (r *textRenderer) Refresh() {
r.Layout(r.obj.Size())
canvas.Refresh(r.obj.super())

r.obj.propertyLock.Lock()
r.obj.cleanVisualCache()
r.obj.propertyLock.Unlock()
}

func (r *textRenderer) layoutRow(texts []fyne.CanvasObject, align fyne.TextAlign, xPos, yPos, lineWidth float32) (float32, float32) {
Expand Down

0 comments on commit a65b4dc

Please sign in to comment.