fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.14k stars 1.4k forks source link

Error in new fyne release 2.5.0 #5009

Open aniketmanna opened 3 months ago

aniketmanna commented 3 months ago

Checklist

Describe the bug

whenever i am running the code it is giving this error PS C:\Users\go\src\Toolkit\cmd\toolKit> go run .
2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started Loading Cache 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 File exists. 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x20 pc=0x7ff60315a587]

goroutine 20 [running]: fyne.io/fyne/v2.MeasureText({0xc0001e7ac0, 0x0}, 0x41600000, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0})
C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/text.go:72 +0x47 fyne.io/fyne/v2/widget.(RichText).updateRowBounds.func1({0xc0001b30e0?, 0x7ff60415cd87?, 0x7ff60415b5c4?}) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/richtext.go:479 +0x892 fyne.io/fyne/v2/widget.(RichText).updateRowBounds(0xc0002cbd28) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/richtext.go:493 +0x212 fyne.io/fyne/v2/widget.(Entry).updateText(0xc0002cbc08, {0x0?, 0x0?}, 0x1) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:1542 +0xa5 fyne.io/fyne/v2/widget.(Entry).updateTextAndRefresh(0xc0002cbc08, {0x0, 0x0}, 0x1) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:1564 +0x52 fyne.io/fyne/v2/widget.(Entry).setText(0xc0002cbc08, {0x0, 0x0}, 0x1) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:541 +0x46 fyne.io/fyne/v2/widget.(Entry).updateFromData(0xc0002cbc08, {0x1de09f13498?, 0xc0002e3700?})
C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:1496 +0xce fyne.io/fyne/v2/widget.(basicBinder).Bind.func1() C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/bind_helper.go:27 +0x32 fyne.io/fyne/v2/data/binding.(listener).DataChanged(0x1?) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/data/binding/binding.go:56 +0x12 fyne.io/fyne/v2/data/binding.queueItem.func1.1() C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/data/binding/queue.go:19 +0x3c created by fyne.io/fyne/v2/data/binding.queueItem.func1 in goroutine 1 C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/data/binding/queue.go:17 +0x49 exit status 2

(note:- i didnt changed a single line of code in my program only updated the fyne version from 2.4 to 2.5.0 and now i am getting this error earlier it was working fyne)

How to reproduce

dont know why its happening with the new fyne version.

Screenshots

No response

Example code

PS C:\Users\KVHQ83\go\src\Toolkit\cmd\toolKit> go run .
2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started Loading Cache 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 File exists. 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 2024/07/19 12:47:37 Fyne error: Attempt to access current Fyne app when none is started 2024/07/19 12:47:37 At: C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/app.go:95 panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x20 pc=0x7ff60315a587]

goroutine 20 [running]: fyne.io/fyne/v2.MeasureText({0xc0001e7ac0, 0x0}, 0x41600000, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0})
C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/text.go:72 +0x47 fyne.io/fyne/v2/widget.(RichText).updateRowBounds.func1({0xc0001b30e0?, 0x7ff60415cd87?, 0x7ff60415b5c4?}) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/richtext.go:479 +0x892 fyne.io/fyne/v2/widget.(RichText).updateRowBounds(0xc0002cbd28) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/richtext.go:493 +0x212 fyne.io/fyne/v2/widget.(Entry).updateText(0xc0002cbc08, {0x0?, 0x0?}, 0x1) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:1542 +0xa5 fyne.io/fyne/v2/widget.(Entry).updateTextAndRefresh(0xc0002cbc08, {0x0, 0x0}, 0x1) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:1564 +0x52 fyne.io/fyne/v2/widget.(Entry).setText(0xc0002cbc08, {0x0, 0x0}, 0x1) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:541 +0x46 fyne.io/fyne/v2/widget.(Entry).updateFromData(0xc0002cbc08, {0x1de09f13498?, 0xc0002e3700?})
C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/entry.go:1496 +0xce fyne.io/fyne/v2/widget.(basicBinder).Bind.func1() C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/widget/bind_helper.go:27 +0x32 fyne.io/fyne/v2/data/binding.(listener).DataChanged(0x1?) C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/data/binding/binding.go:56 +0x12 fyne.io/fyne/v2/data/binding.queueItem.func1.1() C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/data/binding/queue.go:19 +0x3c created by fyne.io/fyne/v2/data/binding.queueItem.func1 in goroutine 1 C:/Users/go/pkg/mod/fyne.io/fyne/v2@v2.5.0/data/binding/queue.go:17 +0x49 exit status 2

Fyne version

2.5.0

Go compiler version

1.21.6

Operating system and version

windows11

Additional Information

No response

andydotxyz commented 3 months ago

You should consider fixing the errors that are logged by your application. I don't know if it is related.

We cannot help unless you share a code snippet that demonstrates how the issue is triggered...

rfletchr commented 3 months ago

I had the same error

package main

import (
    "fyne.io/fyne/theme"
    "fyne.io/fyne/v2/app"
    "fyne.io/fyne/v2/container"

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

func main() {
    myApp := app.New()
    myWindow := myApp.NewWindow("Model Downloader")

    tabs := container.NewAppTabs()
    tabs.Append(container.NewTabItemWithIcon("Downloads", theme.DownloadIcon(), widget.NewLabel("Downloads")))
    tabs.Append(container.NewTabItemWithIcon("Config", theme.SettingsIcon(), widget.NewLabel("Config")))

    tabs.SetTabLocation(container.TabLocationLeading)

    myWindow.SetContent(tabs)
    myWindow.ShowAndRun()
}

This was caused by my uncommenting of the commented out line in the app tabs example I ran the suggested go get command which suggested fyne.io/fyne/theme when it should have been fyne.io/fyne/v2/theme

This was completely a mistake on my part not an issue with fyne.

andydotxyz commented 3 months ago

Can you please share the code that triggers it @aniketmanna? If there's no more info we'll need to close the issue.

andydotxyz commented 2 months ago

I ran the suggested go get command which suggested fyne.io/fyne/theme when it should have been fyne.io/fyne/v2/theme

Yes this is annoying bug in gopls/VSCode where it won't default to match the major version of the existing imports.