Skip to content

Commit

Permalink
internal/driver/glfw: clean the cache periodically.
Browse files Browse the repository at this point in the history
The cache is supposed to be cleaned periodically, but the glfw
driver does not do this as the mobile driver does.

This commit adds similar logic to the glfw driver as exists in
the mobile driver, to periodically clean the cache on paint events.

Fixes fyne-io#4903
  • Loading branch information
knusbaum committed Sep 4, 2024
1 parent 7d81356 commit 0a36617
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/driver/glfw/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (d *gLDriver) repaintWindow(w *window) {
w.shouldExpand = true
w.viewLock.Unlock()
}
canvas.FreeDirtyTextures()
refresh := canvas.FreeDirtyTextures() > 0

updateGLContext(w)
canvas.paint(canvas.Size())
Expand All @@ -225,6 +225,7 @@ func (d *gLDriver) repaintWindow(w *window) {
if view != nil && visible {
view.SwapBuffers()
}
cache.Clean(refresh)
})
}

Expand Down

0 comments on commit 0a36617

Please sign in to comment.