Skip to content

Secondary windows is not refreshed correctly #5782

@NicolasPerrenoud

Description

@NicolasPerrenoud

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

When widgets on multiple windows are modified simultaneously only the widget on the first window are updated

How to reproduce

  1. Create two windows with a label
  2. Update labels on both windows simultaneously

Screenshots

Image

Example code


package main

import (
	"fmt"
	"time"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w1 := a.NewWindow("W1")
	w2 := a.NewWindow("W2")
	l1 := widget.NewLabel("0")
	l2 := widget.NewLabel("0")

	w1.SetContent(l1)
	w1.Resize(fyne.NewSize(200, 50))
	w2.SetContent(l2)
	w2.Resize(fyne.NewSize(200, 50))
	go func() {

		i := 0

		for {
			time.Sleep(300 * time.Millisecond)
			fyne.Do(func() {
				i++
				l1.SetText(fmt.Sprint(i))
				l1.Refresh()
				l2.SetText(fmt.Sprint(i))
				l2.Refresh()
			})
		}
	}()

	w1.Show()
	w2.Show()

	a.Run()
}

Fyne version

v2.6.1

Go compiler version

go1.23.4

Operating system and version

Windows 11

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions