When resizing a window on MacOS (10.14) a Fyne app (e.g. fyne_demo) eventually crashes:
Branch: develop (85790ee4)
I cannot replicate this on the same hardware.
What was it that you did to make it happen? The crash log seems to be deep in GL code so I couldn't figure out any particular trigger.
Edit: Forgot to say I'm on Windows
I encountered a similar error when using this code, and resizing the window
I installed Fyne using the instructions on the README
I am new to go, I don't really understand what's going on 😕
I have a suspicion it is something to do with my display
It is a high resolution display (2736x1824) Surface Pro 1796
The controls don't look quite right when running.
Maybe I should use a different display?
Here is the code
package main
import (
"fyne.io/fyne/widget"
"fyne.io/fyne/app"
)
func main() {
app := app.New()
w := app.NewWindow("Hello")
w.SetContent(widget.NewVBox(
widget.NewLabel("Hello Fyne!"),
widget.NewButton("Quit", func() {
app.Quit()
}),
widget.NewButton("New Window",func() {
w2 := app.NewWindow("Another Window")
w2.SetContent(widget.NewLabel("Hello again!"))
w2.ShowAndRun()
}),
))
w.ShowAndRun()
}
Console output
rohan@DESKTOP-Q4LRFRP MINGW64 ~/source/repos/GoApp
$ go run main.go
2020/06/01 14:57:02 PlatformError: WGL: Failed to make context current
Exception 0xc0000005 0x0 0x37d0 0x7ffcc7b5c638
PC=0x7ffcc7b5c638
runtime: unknown pc 0x7ffcc7b5c638
stack: frame={sp:0x2870fe00, fp:0x0} stack=[0x0,0x2870fe80)
000000002870fd00: 000000c00007b498 00007ffd15afb7ba
000000002870fd10: 0000000000000200 0000000000000015
000000002870fd20: 0000000000000016 00007ffd17a40000
000000002870fd30: 000000c000000008 000000002870fd60
000000002870fd40: 0000000000000001 0000000000000000
000000002870fd50: 0000000000000000 000000b200000004
000000002870fd60: 000000c00000008e 000000c00025a000
000000002870fd70: 0000000801000006 000000010000008e
000000002870fd80: 00000000000e000d 000000c000220150
000000002870fd90: 000000c000040d48 000000000046588e
000000002870fda0: 000000000000026c 000000c00025a000
000000002870fdb0: 0000000000000047 000000c00007b5a8
000000002870fdc0: 0000000000000000 00000000004196d0
000000002870fdd0: 0000000000002000 0000000028713d20
000000002870fde0: 000000c000036c00 00007ffce0d12efb
000000002870fdf0: 0000000000000000 0000000028713d83
000000002870fe00: <00000000001c1500 000000002870fe60
000000002870fe10: 000000000045f62b
000000002870fe20: 000000c00007bc40 0000000000463493
000000002870fe30: 000000c00007bc40 000000c00007bc28
000000002870fe40: 000000c000036c00 000000c000033800
000000002870fe50: 000000c000198180 0000000000000430
000000002870fe60: 000000c000198180 0000000000461c4b
000000002870fe70: 000000000043be90
runtime: unknown pc 0x7ffcc7b5c638
stack: frame={sp:0x2870fe00, fp:0x0} stack=[0x0,0x2870fe80)
000000002870fd00: 000000c00007b498 00007ffd15afb7ba
000000002870fd10: 0000000000000200 0000000000000015
000000002870fd20: 0000000000000016 00007ffd17a40000
000000002870fd30: 000000c000000008 000000002870fd60
000000002870fd40: 0000000000000001 0000000000000000
000000002870fd50: 0000000000000000 000000b200000004
000000002870fd60: 000000c00000008e 000000c00025a000
000000002870fd70: 0000000801000006 000000010000008e
000000002870fd80: 00000000000e000d 000000c000220150
000000002870fd90: 000000c000040d48 000000000046588e
000000002870fda0: 000000000000026c 000000c00025a000
000000002870fdb0: 0000000000000047 000000c00007b5a8
000000002870fdc0: 0000000000000000 00000000004196d0
000000002870fdd0: 0000000000002000 0000000028713d20
000000002870fde0: 000000c000036c00 00007ffce0d12efb
000000002870fdf0: 0000000000000000 0000000028713d83
000000002870fe00: <00000000001c1500 000000002870fe60
000000002870fe10: 000000000045f62b
000000002870fe20: 000000c00007bc40 0000000000463493
000000002870fe30: 000000c00007bc40 000000c00007bc28
000000002870fe40: 000000c000036c00 000000c000033800
000000002870fe50: 000000c000198180 0000000000000430
000000002870fe60: 000000c000198180 0000000000461c4b
000000002870fe70: 000000000043be90
goroutine 18 [syscall]:
fyne.io/fyne/vendor/github.com/go-gl/gl/v3.2-core/gl._Cfunc_glowUseProgram(0x7ffcc7b5c610, 0x3)
_cgo_gotypes.go:21374 +0x48
fyne.io/fyne/vendor/github.com/go-gl/gl/v3.2-core/gl.UseProgram(...)
C:/Users/rohan/go/src/fyne.io/fyne/vendor/github.com/go-gl/gl/v3.2-core/gl/package.go:12648
fyne.io/fyne/internal/painter/gl.(glPainter).glClearBuffer(0xc000202060)
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/gl/gl_core.go:161 +0x44
fyne.io/fyne/internal/painter/gl.(glPainter).Clear(0xc000202060)
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/gl/painter.go:50 +0x32
fyne.io/fyne/internal/driver/glfw.(glCanvas).paint(0xc000216000, 0x72d, 0x2bd)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/canvas.go:301 +0x72
fyne.io/fyne/internal/driver/glfw.(gLDriver).repaintWindow.func1()
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/loop.go:128 +0x8f
fyne.io/fyne/internal/driver/glfw.(window).RunWithContext(0xc000210000, 0xc00007bd38)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1008 +0x3f
fyne.io/fyne/internal/driver/glfw.(gLDriver).repaintWindow(0xc000077110, 0xc000210000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/loop.go:121 +0x6d
fyne.io/fyne/internal/driver/glfw.(gLDriver).runGL(0xc000077110)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/loop.go:110 +0x3cf
fyne.io/fyne/internal/driver/glfw.(gLDriver).Run(0xc000077110)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/driver.go:66 +0x32
fyne.io/fyne/internal/driver/glfw.(window).ShowAndRun(0xc000210000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:391 +0x5e
main.main.func2()
C:/Users/rohan/source/repos/GoApp/main.go:20 +0xe9
fyne.io/fyne/widget.(Button).Tapped(0xc0001ae1b0, 0xc00001c700)
C:/Users/rohan/go/src/fyne.io/fyne/widget/button.go:169 +0x44
fyne.io/fyne/internal/driver/glfw.(window).mouseClicked.func6()
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:677 +0x3f
fyne.io/fyne/internal/driver/glfw.(window).runEventQueue(0xc0001b8000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1052 +0x57
created by fyne.io/fyne/internal/driver/glfw.(*gLDriver).CreateWindow.func1
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1084 +0x175
goroutine 1 [syscall, locked to thread]:
fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw._Cfunc_glfwMakeContextCurrent(0x29fca3d0)
_cgo_gotypes.go:1130 +0x48
fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw.(Window).MakeContextCurrent.func1(0xc00020e000)
C:/Users/rohan/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/context.go:16 +0x5c
fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw.(Window).MakeContextCurrent(0xc00020e000)
C:/Users/rohan/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/context.go:16 +0x32
fyne.io/fyne/internal/driver/glfw.(window).RunWithContext(0xc000210000, 0xc000107aa8)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1006 +0x35
fyne.io/fyne/internal/driver/glfw.forceWindowRefresh(0xc000210000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/gl_windows.go:17 +0x55
fyne.io/fyne/internal/driver/glfw.(window).refresh(0xc000210000, 0xc00020e000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:496 +0x32
fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw.goWindowRefreshCB(0x29fca3d0)
C:/Users/rohan/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/window.go:203 +0x50
fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw._cgoexpwrap_b702e4d2cd06_goWindowRefreshCB(0x29fca3d0)
_cgo_gotypes.go:2211 +0x32
fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw._Cfunc_glfwPollEvents()
_cgo_gotypes.go:1156 +0x48
fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw.PollEvents()
C:/Users/rohan/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/window.go:777 +0x29
fyne.io/fyne/internal/driver/glfw.(gLDriver).runGL(0xc000077110)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/loop.go:87 +0x206
fyne.io/fyne/internal/driver/glfw.(gLDriver).Run(0xc000077110)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/driver.go:66 +0x32
fyne.io/fyne/internal/driver/glfw.(*window).ShowAndRun(0xc0001b8000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:391 +0x5e
main.main()
C:/Users/rohan/source/repos/GoApp/main.go:24 +0x307
goroutine 6 [sleep]:
time.Sleep(0x22ecb25c00)
C:/Go/src/runtime/time.go:188 +0xc8
fyne.io/fyne/internal/painter.svgCacheJanitor.func1()
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/svg_cache.go:51 +0x11d
sync.(Once).doSlow(0xe1ac30, 0xc000018230)
C:/Go/src/sync/once.go:66 +0xf3
sync.(Once).Do(0xe1ac30, 0xc000018230)
C:/Go/src/sync/once.go:57 +0x4c
created by fyne.io/fyne/internal/painter.svgCacheJanitor
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/svg_cache.go:49 +0xa2
goroutine 7 [chan receive]:
fyne.io/fyne/app.NewAppWithDriver.func1(0xc000052180, 0xc00004e240)
C:/Users/rohan/go/src/fyne.io/fyne/app/app.go:108 +0x44
created by fyne.io/fyne/app.NewAppWithDriver
C:/Users/rohan/go/src/fyne.io/fyne/app/app.go:106 +0x197
goroutine 8 [syscall, locked to thread]:
syscall.Syscall6(0x7ffd17a565d0, 0x5, 0x290, 0xc000047d10, 0xc000047d14, 0xc000047d78, 0xffffffff, 0x0, 0x0, 0x0, ...)
C:/Go/src/runtime/syscall_windows.go:201 +0xf2
syscall.GetQueuedCompletionStatus(0x290, 0xc000047d10, 0xc000047d14, 0xc000047d78, 0xffffffff, 0x0, 0x0)
C:/Go/src/syscall/zsyscall_windows.go:556 +0xb6
fyne.io/fyne/vendor/github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc00004c300)
C:/Users/rohan/go/src/fyne.io/fyne/vendor/github.com/fsnotify/fsnotify/windows.go:381 +0x98
created by fyne.io/fyne/vendor/github.com/fsnotify/fsnotify.NewWatcher
C:/Users/rohan/go/src/fyne.io/fyne/vendor/github.com/fsnotify/fsnotify/windows.go:46 +0x1f8
goroutine 9 [chan receive]:
fyne.io/fyne/app.watchFile.func1(0xc00004c300, 0xc00001e3c0, 0x31, 0xc000043170, 0xc000043180)
C:/Users/rohan/go/src/fyne.io/fyne/app/settings_desktop.go:42 +0x5f
created by fyne.io/fyne/app.watchFile
C:/Users/rohan/go/src/fyne.io/fyne/app/settings_desktop.go:41 +0xee
goroutine 19 [chan receive]:
fyne.io/fyne/internal/driver/glfw.(glCanvas).setupThemeListener.func1(0xc0001c6000, 0xc0001be000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/canvas.go:409 +0x4e
created by fyne.io/fyne/internal/driver/glfw.(glCanvas).setupThemeListener
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/canvas.go:407 +0xad
goroutine 10 [chan receive]:
fyne.io/fyne/internal/painter.SvgCacheMonitorTheme.func1(0xc0000522a0)
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/svg_cache.go:104 +0x3b
created by fyne.io/fyne/internal/painter.SvgCacheMonitorTheme
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/svg_cache.go:102 +0xa3
goroutine 34 [chan receive]:
fyne.io/fyne/internal/driver/glfw.(window).runEventQueue(0xc000210000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1051 +0x8d
created by fyne.io/fyne/internal/driver/glfw.(gLDriver).CreateWindow.func1
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1084 +0x175
goroutine 35 [chan receive]:
fyne.io/fyne/internal/driver/glfw.(glCanvas).setupThemeListener.func1(0xc00020c060, 0xc000216000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/canvas.go:409 +0x4e
created by fyne.io/fyne/internal/driver/glfw.(glCanvas).setupThemeListener
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/canvas.go:407 +0xad
goroutine 21 [chan receive]:
fyne.io/fyne/internal/painter.SvgCacheMonitorTheme.func1(0xc0001c67e0)
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/svg_cache.go:104 +0x3b
created by fyne.io/fyne/internal/painter.SvgCacheMonitorTheme
C:/Users/rohan/go/src/fyne.io/fyne/internal/painter/svg_cache.go:102 +0xa3
rax 0xe2320
rbx 0xc00007bc40
rcx 0x18
rdi 0x3
rsi 0xc000036c00
rbp 0xc00007bc00
rsp 0x2870fe00
r8 0xc000198180
r9 0x0
r10 0x20
r11 0x2
r12 0x20
r13 0x7e
r14 0x1
r15 0x2030000
rip 0x7ffcc7b5c638
rflags 0x10206
cs 0x33
fs 0x53
gs 0x2b
exit status 2
The screenshot you provided looks like it's not running our 'develop' branch which means a lot has changed already. We re-wrote quite a bit of scale and resize/paint handling.
If possible can you test the develop branch? If not then the 1.3 release should be out soon and it may fix your issue.
I already have the master branch version of Fyne installed. Will I have to remove my existing Fyne install? Also, can you guide me towards instructions to install the latest develop branch? Thanks.
You do not have to remove it, you can install over the top. The following should be sufficient for an existing installation:
cd $GOPATH/src/fyne.io/fyne/cmd/fyne
git checkout develop
git pull
go install
Then run fyne_demo again and you should see it has different tabs. Let us know if this changes the situation.

It looks like the parameters are valid and that it's running on the right thread - might need a bit more digging at your send to inspect the values to see which is corrupting or causing unexpected state?
The fyne_demo looks good. The buttons are a little too big. I'm not too sure how the scaling works, but maybe it is possible to change the scale based on screen resolution?
The code that I wrote in my previous comment crashed with a different error message, and it didn't crash when I resized it, it crashed immediately after opening a new window.
package main
import (
"fyne.io/fyne/app"
"fyne.io/fyne/widget"
)
func main() {
var app = app.New()
var w = app.NewWindow("Hello")
w.SetContent(widget.NewVBox(
widget.NewLabel("Hello Fyne!"),
widget.NewButton("Quit", func() {
app.Quit()
}),
widget.NewButton("New Window",func() {
var w2 = app.NewWindow("Another Window")
w2.SetContent(widget.NewLabel("Hello again!"))
w2.ShowAndRun() /*will crash*/
}),
))
w.ShowAndRun()
}
Console Output
rohan@DESKTOP-Q4LRFRP MINGW64 ~/source/repos/GoApp (master)
$ go run main.go
panic: Run() or ShowAndRun() must be called from main goroutine
goroutine 34 [running]:
fyne.io/fyne/internal/driver/glfw.(gLDriver).Run(0xc00004c2c0)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/driver.go:68 +0x64
fyne.io/fyne/internal/driver/glfw.(window).ShowAndRun(0xc000058000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:387 +0x5e
main.main.func2()
C:/Users/rohan/source/repos/GoApp/main.go:20 +0xdd
fyne.io/fyne/widget.(Button).Tapped(0xc0002320b0, 0xc00008c000)
C:/Users/rohan/go/src/fyne.io/fyne/widget/button.go:220 +0x9e
fyne.io/fyne/internal/driver/glfw.(window).mouseClicked.func6()
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:664 +0x6d
fyne.io/fyne/internal/driver/glfw.(window).runEventQueue(0xc000204000)
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1071 +0x81
created by fyne.io/fyne/internal/driver/glfw.(gLDriver).createWindow.func1
C:/Users/rohan/go/src/fyne.io/fyne/internal/driver/glfw/window.go:1095 +0x10a
exit status 2
Don’t call ShowAndRun() a second time, use just Show().
If you want things to be a little smaller then run the included fyne_settings app and choose “smaller” :)
Thanks, but for some reason I was not able to run fyne_settings from my terminal. I had to go into /go/src/fyne.io/fyne/cmd/fyne_settings and do go run main.go
Reports are that this does not happen since 1.3.0 according to @toaster