Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boxLayout crash when items rapidly added and removed #2481

Closed
zdima opened this issue Sep 19, 2021 · 2 comments
Closed

boxLayout crash when items rapidly added and removed #2481

zdima opened this issue Sep 19, 2021 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@zdima
Copy link
Contributor

zdima commented Sep 19, 2021

Describe the bug:

The boxLayout.MinSize or boxLayout.Layout crashing when items rapidly added and removed from the NewVBox container.

To Reproduce:

Steps to reproduce the behaviour:

  1. Run the code from example below and app will crash with "invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation]" at layout/boxlayout.go:63 or layout/boxlayout.go:125.

Example code:

package main

import (
	"fmt"
	"image/color"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
	"fyne.io/fyne/v2/container"
)

var maxLines = 40

func main() {

	a := app.New()
	w := a.NewWindow("test")

	box := container.NewVBox()
	sc := container.NewVScroll(box)
	w.SetContent(sc)
	w.Resize(fyne.NewSize(400, 400))

	go func() {

		addLine := func(line string) {
			t := canvas.NewText(line, color.Black)
			t.TextStyle = fyne.TextStyle{Monospace: true}
			box.Add(t)
			for len(box.Objects) > maxLines {
				box.Remove(box.Objects[0])
			}
			sc.ScrollToBottom()
		}

		for i := 0; i < 5000; i++ {
			line := fmt.Sprintf("%04d:", i)
			addLine(line)
		}
		addLine("end")
	}()

	w.ShowAndRun()
}

Device (please complete the following information):

  • OS: MacOS
  • Version: 11.6
  • Go version: go1.16.5 darwin/arm64
  • Fyne version: 6e90820
@zdima zdima added the unverified A bug that has been reported but not verified label Sep 19, 2021
@andydotxyz
Copy link
Member

I think this is probably a duplicate of #1028, but we should keep it open as a clear reproduction case for the underlying issue

@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Sep 22, 2021
@Jacalz Jacalz added the duplicate This issue or pull request already exists label Mar 11, 2022
@Jacalz Jacalz removed this from the Bowmore Release (early 2022) milestone Mar 11, 2022
@Jacalz
Copy link
Member

Jacalz commented Mar 11, 2022

Closing as a duplicate of #2826.

@Jacalz Jacalz closed this as completed Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants