Fix possible segfault in X backend

This commit is contained in:
Sasha Koshka 2022-11-15 11:40:10 -05:00
parent 1eceb53b94
commit 02d010818f
2 changed files with 5 additions and 1 deletions

View File

@ -33,6 +33,10 @@ func (backend *Backend) handleConfigureNotify (
configureEvent =
backend.compressConfigureNotify(configureEvent)
// we should not resize the canvas while drawing is taking place
backend.drawLock.Lock()
defer backend.drawLock.Unlock()
// resize buffer
width, height := backend.calculateBufferSize()
backend.application.SetSize(width, height)

View File

@ -44,7 +44,7 @@ func main () {
}
func redraw () {
text :="RAINBOW :D"
text := "RAINBOW :D"
width, height := application.Size()
application.Dot.X = (width - len(text)) / 2