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

Wrappable RichText in a Split container causes crash #3003

Closed
matwachich opened this issue May 23, 2022 · 5 comments
Closed

Wrappable RichText in a Split container causes crash #3003

matwachich opened this issue May 23, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@matwachich
Copy link
Contributor

Describe the bug:

App crashing (index out of range) when totally shrinking a RichText with a HSplit container

To Reproduce:

Run the provided code, and slide completly to the right

Example code:

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("TItle")

	rich := widget.NewRichText()
	rich.Wrapping = fyne.TextWrapWord
	rich.ParseMarkdown("Hello, world!")

	w.SetContent(
		container.NewHSplit(
			widget.NewLabel("Test"),
			rich,
		),
	)

	w.Resize(fyne.NewSize(800, 400))
	w.ShowAndRun()
}

-->

Device (please complete the following information):

  • OS: Windows
  • Version: 10
  • Go version: 1.18.2
  • Fyne version: 2.1.4
@matwachich matwachich added the unverified A bug that has been reported but not verified label May 23, 2022
@andydotxyz
Copy link
Member

Can you please provide the crash log, it will be helpful to verify the issue and confirm the fix.

@matwachich
Copy link
Contributor Author

panic: runtime error: index out of range [-1]

goroutine 19 [running]:
fyne.io/fyne/v2/widget.(*RichText).updateRowBounds.func1({0xc000088300?, 0x2, 0x4?})
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/widget/richtext.go:381 +0xc25
fyne.io/fyne/v2/widget.(*RichText).updateRowBounds(0xc0000c0000)
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/widget/richtext.go:411 +0x103
fyne.io/fyne/v2/widget.(*RichText).Resize(0xc0000c0000, {0x44460000?, 0x42370000?})
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/widget/richtext.go:109 +0x105
fyne.io/fyne/v2/container.(*splitContainerRenderer).Layout(0xc000092120, {0x39c000?, 0xc0?})
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/container/split.go:126 +0x237
fyne.io/fyne/v2/container.(*splitContainerRenderer).Refresh(0xc000092120)
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/container/split.go:155 +0xa5
fyne.io/fyne/v2/widget.(*BaseWidget).Refresh(0x7ff72e33f0fd?)
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/widget/widget.go:138 +0x2e
fyne.io/fyne/v2/container.(*Split).SetOffset(...)
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/container/split.go:79
fyne.io/fyne/v2/container.(*divider).Dragged(0xc0000a8050, 0xc000090078)
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/container/split.go:248 +0x216
fyne.io/fyne/v2/internal/driver/glfw.(*window).mouseMoved.func5()
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/internal/driver/glfw/window.go:732 +0x26
fyne.io/fyne/v2/internal/driver/common.(*Window).RunEventQueue(0xc0000b4000)
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/internal/driver/common/window.go:58 +0x56
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1
        C:/Users/Matwachich/Programmation/GoLang/src/Fyne/vendor/fyne.io/fyne/v2/internal/driver/glfw/window.go:1413 +0x156
exit status 2

@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels May 24, 2022
@andydotxyz
Copy link
Member

Thanks, confirmed

@andydotxyz
Copy link
Member

I have a working fix, which wraps the word down to letters when there is not room.
But realistically I thought, should we not have the min size to the smallest word in the content?
Technically yes - but what if it's a really long word? I don't know if we should prop the content open...

@andydotxyz
Copy link
Member

Fix will be in v2.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants