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

Setting Position1 of canvas.Circle higher than its Position2 causes panic. #3949

Closed
2 tasks done
brokenarmor451 opened this issue Jun 5, 2023 · 6 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@brokenarmor451
Copy link

brokenarmor451 commented Jun 5, 2023

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 I make a circle using struct initilazation, I have set Position1 value higher than Position2 and get this panic:

panic: runtime error: index out of range [0] with length 0
goroutine 38 [running, locked to thread]:
golang.org/x/image/vector.(*Rasterizer).rasterizeDstRGBASrcUniformOpOver(0xc0004a0000, 0xc00049a040, {{0x3ff0000000000000?, 0x0?}, {0x0?, 0x3ff0000000000000?}}, 0xffff, 0xffff, 0xffff, 0xffff)
	/home/armor/go/pkg/mod/golang.org/x/[email protected]/vector/vector.go:398 +0x2d4
golang.org/x/image/vector.(*Rasterizer).Draw(0xc0004a0000, {0xc793f8?, 0xc00049a040}, {{0xc020000000000000?, 0x0?}, {0x3ff0000000000000?, 0x0?}}, {0xc787f0?, 0xc00049a080?}, {0x0, ...})
	/home/armor/go/pkg/mod/golang.org/x/[email protected]/vector/vector.go:287 +0x188
github.com/srwiley/rasterx.(*ScannerGV).Draw(0xc0004a0000)
	/home/armor/go/pkg/mod/github.com/srwiley/[email protected]/scan.go:141 +0x85
fyne.io/fyne/v2/internal/painter.DrawCircle(0xc0000ae180, 0xae180?, 0xc000486720)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/draw.go:37 +0x39e
fyne.io/fyne/v2/internal/painter/gl.(*painter).newGlCircleTexture(0xc00048e000, {0xc7bde0?, 0xc0000ae180})
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/gl/texture.go:108 +0x75
fyne.io/fyne/v2/internal/painter/gl.(*painter).getTexture(0xc00048e000, {0xc7bde0, 0xc0000ae180}, 0xc0004868a8)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/gl/texture.go:36 +0x4f
fyne.io/fyne/v2/internal/painter/gl.(*painter).drawTextureWithDetails(0xc00048e000, {0xc7bde0?, 0xc0000ae180?}, 0x4349a8?, {0x486920?, 0xc0?}, {0x43cc30?, 0x0?}, {0x18?, 0x0?}, ...)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/gl/draw.go:171 +0x8b
fyne.io/fyne/v2/internal/painter/gl.(*painter).drawCircle(0xc00048e000, 0xc0000ae180, {0x486988?, 0xc0?}, {0x42a145?, 0x0?})
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/gl/draw.go:31 +0xd4
fyne.io/fyne/v2/internal/painter/gl.(*painter).drawObject(0xc0002d6eb8?, {0xc7bde0?, 0xc0000ae180?}, {0x43275d?, 0x0?}, {0xabf600?, 0x0?})
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/gl/draw.go:79 +0x3f
fyne.io/fyne/v2/internal/painter/gl.(*painter).Paint(0x18?, {0xc7bde0, 0xc0000ae180}, {0x90628448?, 0x7f53?}, {0xb9ae3f18?, 0x7f53?})
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/painter/gl/painter.go:89 +0x74
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).paint.func1(0xc000486a20?, {0x8b2c94?, 0x0?})
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/canvas.go:287 +0x115
fyne.io/fyne/v2/internal/driver/common.(*Canvas).walkTree.func1({0xc7bde0?, 0xc0000ae180}, {0xae180?, 0xc0?}, {0x9e0f0?, 0xc0?}, {0x8b5650?, 0x0?})
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:438 +0x277
fyne.io/fyne/v2/internal/driver.walkObjectTree({0xc7bde0, 0xc0000ae180}, 0x0, {0xc7bd80, 0xc00009e0f0}, {0x9e0f0?, 0xc0?}, {0x0?, 0x0?}, {0x0?, ...}, ...)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:169 +0x2b2
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree({0xc7bd80, 0xc00009e0f0}, 0x0, {0x0, 0x0}, {0x466e31?, 0x0?}, {0x0?, 0x0?}, {0x486c38?, ...}, ...)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:190 +0x3ec
fyne.io/fyne/v2/internal/driver.WalkVisibleObjectTree({0xc7bd80?, 0xc00009e0f0?}, 0xc000082820?, 0x200000003?)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/util.go:134 +0x4c
fyne.io/fyne/v2/internal/driver/common.(*Canvas).walkTree(0xc000000000?, 0xc000092560, 0xc000486d80, 0xc000486d50)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:459 +0x165
fyne.io/fyne/v2/internal/driver/common.(*Canvas).WalkTrees(0xc00009a240, 0xc000486d50?, 0x9fa246?)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/canvas.go:371 +0x3c
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).paint(0xc00009a240, {0x0?, 0x0?})
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/canvas.go:299 +0xfb
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow.func1()
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:207 +0x8f
fyne.io/fyne/v2/internal/driver/glfw.(*window).RunWithContext(0xc0003c13b0?, 0xc000486e30)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/window.go:907 +0x4f
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow(0xc000486e98?, 0xc000122880?)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:198 +0x4a
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).drawSingleFrame(0xc000486f90?)
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:106 +0x1ac
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread.func1()
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:254 +0x1a6
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread
	/home/armor/go/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/loop.go:230 +0xea
exit status 2

I have noticed if I set Position1: fyne.NewPos(214, 214) , Position2: fyne.NewPos(200, 200) There is no problem. But at 215, 215 and higher (I didn't test all values) gave that panic.

How to reproduce

Make a circle as in the example code, then run to see the panic.

Screenshots

No response

Example code

package main

import (
    "fyne.io/fyne/v2"
    "fyne.io/fyne/v2/app"
    "fyne.io/fyne/v2/canvas"
    "fyne.io/fyne/v2/container"
    "image/color"
)

func main() {

    a := app.New()

    w := a.NewWindow("Reporting")
    w.Resize(fyne.NewSize(900, 900))

	circle := &canvas.Circle{
	    Position1: fyne.NewPos(215, 215),
	    Position2: fyne.NewPos(200, 200),
	    StrokeColor: color.White,
	    StrokeWidth: 5,	
	}

    w.SetContent(container.NewWithoutLayout(circle))

    w.ShowAndRun()

}

Fyne version

2.3.5-rc2

Go compiler version

1.20

Operating system and version

Ubuntu 22.04

Additional Information

I have faced that issue before 2.3.5-rc2 too.

@brokenarmor451 brokenarmor451 added the unverified A bug that has been reported but not verified label Jun 5, 2023
@andydotxyz
Copy link
Member

Can you please paste the full panic not just the first line?
The file and line number info is missing in what you have pasted

@brokenarmor451
Copy link
Author

Can you please paste the full panic not just the first line? The file and line number info is missing in what you have pasted

I am sorry, I thought it was unnecessary to paste full panic code, because I thought you can try example code and get full panic message, anyways I added it.

@andydotxyz
Copy link
Member

Thanks. More info is always better for bug reports :)

@brokenarmor451
Copy link
Author

brokenarmor451 commented Jun 6, 2023

I have tested your fix in the andydotxyz/fyne fix/3949 branch and panic no longer appears. But I don't think myself enough for write a review :)

@andydotxyz
Copy link
Member

I have tested your fix in the andydotxyz/fyne fix/3949 branch and panic no longer appears. But I don't think myself enough for write a review :)

Thanks. It does help the approvers to know that the initial issue is reported fixed.

@Jacalz Jacalz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Jun 7, 2023
@andydotxyz
Copy link
Member

Ready on develop branch for next release

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

3 participants