Skip to content

Intermittent unexpected signal when closing window from code #3874

Description

@tim-timpani

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

Very intermittent. Not specific to any one app I am working on. This one happened just as I clicked on the "okButton" defined in ShowTestCaseDetails() in the sample code below

How to reproduce

I just clicked on the "okButton" to close the window

Screenshots

Stack Trace:

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]

runtime stack:
runtime.throw({0x4de62c2?, 0x4c724aa?})
/usr/local/go/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:802 +0x20e

goroutine 37 [syscall, locked to thread]:
runtime.cgocall(0x4c736b0, 0xc00056de48)
/usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc00056de08 sp=0xc00056ddd0 pc=0x400917c
github.com/go-gl/glfw/v3.3/glfw._Cfunc_glfwMakeContextCurrent(0x0)
_cgo_gotypes.go:1451 +0x45 fp=0xc00056de48 sp=0xc00056de08 pc=0x4bfbba5
github.com/go-gl/glfw/v3.3/glfw.DetachCurrentContext()
/Users/timothy3/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20221017161538-93cebf72946b/context.go:23 +0x25 fp=0xc00056de60 sp=0xc00056de48 pc=0x4bfe405
fyne.io/fyne/v2/internal/driver/glfw.(*window).DetachCurrentContext(0xc0020d03c0)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/window_desktop.go:637 +0x1c fp=0xc00056de70 sp=0xc00056de60 pc=0x4c29fdc
fyne.io/fyne/v2/internal/driver/glfw.(*window).RunWithContext(0xc0020d03c0, 0xc00055e250)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/window.go:909 +0x65 fp=0xc00056de98 sp=0xc00056de70 pc=0x4c25205
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread.func1()
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/loop.go:238 +0x23b fp=0xc00056dfe0 sp=0xc00056de98 pc=0x4c18cfb
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00056dfe8 sp=0xc00056dfe0 pc=0x406ec81
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/loop.go:230 +0x15b

goroutine 1 [runnable, locked to thread]:
github.com/go-gl/glfw/v3.3/glfw.panicError()
/Users/timothy3/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20221017161538-93cebf72946b/error.go:184 +0x7b
github.com/go-gl/glfw/v3.3/glfw.(*Window).ShouldClose(0xc000a46000)
/Users/timothy3/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20221017161538-93cebf72946b/window.go:371 +0x3a
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).runGL(0xc0004cec40)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/loop.go:147 +0x50a
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).Run(0xc0004cec40)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/driver.go:169 +0x9b
fyne.io/fyne/v2/app.(*fyneApp).Run(0xc0001d81b0)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/app/app.go:74 +0x58
pipeline/gui.Run()
/Users/timothy3/git/pipeline/gui/start.go:105 +0x602
main.main()
/Users/timothy3/git/pipeline/main/pipeline.go:6 +0x17

goroutine 35 [syscall]:
syscall.syscall6(0x0?, 0x0?, 0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/sys_darwin.go:44 +0x99
golang.org/x/sys/unix.kevent(0x3, 0x0, 0x0, 0xc00006be70, 0xa, 0x5b04e30)
/Users/timothy3/go/pkg/mod/golang.org/x/sys@v0.7.0/unix/zsyscall_darwin_amd64.go:276 +0xba
golang.org/x/sys/unix.Kevent(0x3, {0x0, 0x0, 0x0}, {0xc00006be70, 0xa, 0xa}, 0x5b04e30)
/Users/timothy3/go/pkg/mod/golang.org/x/sys@v0.7.0/unix/syscall_bsd.go:398 +0x145
github.com/fsnotify/fsnotify.read(0x3, {0xc00006be70, 0xa, 0xa}, 0x5b04e30)
/Users/timothy3/go/pkg/mod/github.com/fsnotify/fsnotify@v1.5.4/kqueue.go:525 +0xa5
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc0001b2540)
/Users/timothy3/go/pkg/mod/github.com/fsnotify/fsnotify@v1.5.4/kqueue.go:288 +0x10d
created by github.com/fsnotify/fsnotify.NewWatcher
/Users/timothy3/go/pkg/mod/github.com/fsnotify/fsnotify@v1.5.4/kqueue.go:63 +0x348

goroutine 36 [chan receive, 3 minutes]:
fyne.io/fyne/v2/app.watchFile.func1()
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/app/settings_desktop.go:43 +0x85
created by fyne.io/fyne/v2/app.watchFile
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/app/settings_desktop.go:42 +0x1ac

goroutine 38 [select, 3 minutes]:
fyne.io/fyne/v2/internal/async.(*UnboundedFuncChan).processing(0xc00048f080)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/async/chan_func.go:45 +0x151
created by fyne.io/fyne/v2/internal/async.NewUnboundedFuncChan
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/async/chan_func.go:22 +0x173

goroutine 39 [chan receive, 3 minutes]:
pipeline/gui.(*BuildDetailsPanel).ShowTestCaseDetails(0xc0004ca3c0)
/Users/timothy3/git/pipeline/gui/panel3.go:399 +0x5e8
pipeline/gui.(*BuildDetailsPanel).testCaseDetailsPress(0xc0004ca3c0)
/Users/timothy3/git/pipeline/gui/panel3.go:311 +0x1e
fyne.io/fyne/v2/widget.(*Button).Tapped(0xc000488dc0, 0x400bb18)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/widget/button.go:202 +0x77
fyne.io/fyne/v2/internal/driver/glfw.(*window).mouseClickedHandleTapDoubleTap.func1()
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/window.go:634 +0x42
fyne.io/fyne/v2/internal/driver/common.(*Window).RunEventQueue(0xc0004323c0)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/common/window.go:35 +0x73
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/window.go:946 +0x1a6

goroutine 30 [chan receive]:
fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations.func1()
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/animation/runner.go:69 +0x67
created by fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/animation/runner.go:67 +0xa5

goroutine 25 [chan receive, 3 minutes]:
fyne.io/fyne/v2/internal/driver/glfw.catchTerm(0xc0004cec40)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/driver.go:188 +0xe6
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).Run
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/driver.go:168 +0x91

goroutine 50 [syscall, 3 minutes]:
os/signal.signal_recv()
/usr/local/go/src/runtime/sigqueue.go:148 +0x28
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:23 +0x1d
created by os/signal.Notify.func1.1
/usr/local/go/src/os/signal/signal.go:151 +0x2e

goroutine 13 [chan receive]:
fyne.io/fyne/v2/internal/driver/glfw.runOnDraw(0xc0020d03c0, 0xc00055e250)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/loop.go:85 +0x21f
fyne.io/fyne/v2/internal/driver/glfw.(*window).Close(0xc0020d03c0)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/window.go:211 +0xcd
pipeline/gui.(*BuildDetailsPanel).ShowTestCaseDetails.func1()
/Users/timothy3/git/pipeline/gui/panel3.go:387 +0x2e
fyne.io/fyne/v2/widget.(*Button).Tapped(0xc000e32280, 0x400bb18)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/widget/button.go:202 +0x77
fyne.io/fyne/v2/internal/driver/glfw.(*window).mouseClickedHandleTapDoubleTap.func1()
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/window.go:634 +0x42
fyne.io/fyne/v2/internal/driver/common.(*Window).RunEventQueue(0xc0020d03c0)
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/common/window.go:35 +0x73
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1
/Users/timothy3/go/pkg/mod/fyne.io/fyne/v2@v2.3.3/internal/driver/glfw/window.go:946 +0x1a6

goroutine 15 [IO wait, 3 minutes]:
internal/poll.runtime_pollWait(0x5468cc0?, 0x72)
/usr/local/go/src/runtime/netpoll.go:302 +0x45
internal/poll.(*pollDesc).wait(0xc001b05b18, 0x72, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:83 +0x88
internal/poll.(*pollDesc).waitRead(0xc001b05b18, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:88 +0x37
internal/poll.(*FD).Read(0xc001b05b00, {0xc00164a000, 0x8949, 0x8949})
/usr/local/go/src/internal/poll/fd_unix.go:167 +0x44f
net.(*netFD).Read(0xc001b05b00, {0xc00164a000, 0x8949, 0x8949})
/usr/local/go/src/net/fd_posix.go:55 +0x73
net.(*conn).Read(0xc0006941f0, {0xc00164a000, 0x8949, 0x8949})
/usr/local/go/src/net/net.go:183 +0xa9
crypto/tls.(*atLeastReader).Read(0xc000c93470, {0xc00164a000, 0x8949, 0x8949})
/usr/local/go/src/crypto/tls/conn.go:785 +0xc2
bytes.(*Buffer).ReadFrom(0xc000a25e78, {0x5466d80, 0xc000c93470})
/usr/local/go/src/bytes/buffer.go:204 +0x142
crypto/tls.(*Conn).readFromUntil(0xc000a25c00, {0x2e513398, 0xc0006941f0}, 0x5)
/usr/local/go/src/crypto/tls/conn.go:807 +0x172
crypto/tls.(*Conn).readRecordOrCCS(0xc000a25c00, 0x0)
/usr/local/go/src/crypto/tls/conn.go:614 +0x1d8
crypto/tls.(*Conn).readRecord(0xc000a25c00)
/usr/local/go/src/crypto/tls/conn.go:582 +0x2b
crypto/tls.(*Conn).Read(0xc000a25c00, {0xc0020c9000, 0x1000, 0x1000})
/usr/local/go/src/crypto/tls/conn.go:1285 +0x217
net/http.(*persistConn).Read(0xc000c90ea0, {0xc0020c9000, 0x1000, 0x1000})
/usr/local/go/src/net/http/transport.go:1929 +0x1dc
bufio.(*Reader).fill(0xc0017fde00)
/usr/local/go/src/bufio/bufio.go:106 +0x294
bufio.(*Reader).Peek(0xc0017fde00, 0x1)
/usr/local/go/src/bufio/bufio.go:144 +0x178
net/http.(*persistConn).readLoop(0xc000c90ea0)
/usr/local/go/src/net/http/transport.go:2093 +0x269
created by net/http.(*Transport).dialConn
/usr/local/go/src/net/http/transport.go:1750 +0x277e

goroutine 16 [select, 3 minutes]:
net/http.(*persistConn).writeLoop(0xc000c90ea0)
/usr/local/go/src/net/http/transport.go:2392 +0x16e
created by net/http.(*Transport).dialConn
/usr/local/go/src/net/http/transport.go:1751 +0x27e7

Example code

func (b *BuildDetailsPanel) ShowTestCaseDetails() {

	tcDetailsWin := mainApp.NewWindow(fmt.Sprintf("TestCase Details - %s", b.selectedTest.ClassName))

	modalChan := make(chan bool)

	// bottom row stuff
	okButton := widget.NewButton("Ok", func() { tcDetailsWin.Close() })
	searchButton := widget.NewButton("Search", func() {})
	buttonRow := container.NewGridWithColumns(3, okButton, layout.NewSpacer(), searchButton)
	buttonCentered := container.NewCenter(buttonRow)

	panels := container.NewHSplit(b.GetTCDetailPanel(), b.GetJiraNavigatorContent())
	tcDetailsWin.SetContent(container.NewBorder(nil, buttonCentered, nil, nil, panels))
	tcDetailsWin.SetOnClosed(func() { close(modalChan) })
	tcDetailsWin.Show()
	tcDetailsWin.Resize(fyne.NewSize(768, 1024))
	running := true
	for running {
		_, running = <-modalChan
	}

}

func (b *BuildDetailsPanel) GetTCDetailPanel() fyne.CanvasObject {

	var suiteLabel *widget.Label
	var suiteTimeLabel *widget.Label
	var classLabel *widget.Label
	var testLabel *widget.Label
	var resultLabel *widget.Label
	var failedSince *widget.Label
	var tcDuration *widget.Label
	var stdErr *widget.RichText
	var stdOut *widget.RichText
	var tcError *widget.RichText
	var tcTrace *widget.RichText

	tc := b.selectedTest
	suiteLabel = widget.NewLabel(fmt.Sprintf("Suite: %s", "?"))
	suiteTimeLabel = widget.NewLabel(fmt.Sprintf("Suite timestamp: %s", "?"))
	classLabel = widget.NewLabel(fmt.Sprintf("Class: %s", tc.ClassName))
	testLabel = widget.NewLabel(fmt.Sprintf("Test: %s", tc.Name))
	resultLabel = widget.NewLabel(fmt.Sprintf("Result: %s", tc.Status))
	failedSince = widget.NewLabel(fmt.Sprintf("FailedSince: %d", tc.FailedSince))
	tcDuration = widget.NewLabel(fmt.Sprintf("TestCase Duration: %s", time.Duration(tc.DurationSeconds)*time.Second))
	stdErr = widget.NewRichTextWithText(data.InterfaceToString(tc.Stderr))
	stdErr.Wrapping = defaultErrorDetailWrapping
	stdOut = widget.NewRichTextWithText(data.InterfaceToString(tc.Stdout))
	stdOut.Wrapping = defaultErrorDetailWrapping
	tcError = widget.NewRichTextWithText(data.InterfaceToString(tc.ErrorDetails))
	tcError.Wrapping = defaultErrorDetailWrapping
	tcTrace = widget.NewRichTextWithText(data.InterfaceToString(tc.ErrorStackTrace))
	tcTrace.Wrapping = defaultErrorDetailWrapping

	labels := container.NewVBox(suiteLabel, suiteTimeLabel, classLabel, testLabel, resultLabel, failedSince, tcDuration)

	errScroll := container.NewScroll(stdErr)
	errTab := container.NewTabItem("StdErr", errScroll)
	outScroll := container.NewScroll(stdOut)
	outTab := container.NewTabItem("StdOut", outScroll)
	detailsTab := container.NewTabItem("Err Details", tcError)
	straceScroll := container.NewScroll(tcTrace)
	traceTab := container.NewTabItem("Trace", straceScroll)
	tcTabs := container.NewAppTabs(errTab, outTab, detailsTab, traceTab)

	return container.NewBorder(labels, nil, nil, nil, tcTabs)

}

func (b *BuildDetailsPanel) GetJiraNavigatorContent() (jiraContainer fyne.CanvasObject) {

	var jiraCards []*jira.ResponseItemsBasicFields
	var jiraErr error

	jiraErrBox := widget.NewRichTextWithText("Loading...")
	jiraErrBox.Wrapping = defaultErrorDetailWrapping
	jiraScroller := container.NewScroll(jiraErrBox)
	jiraScroller.SetMinSize(fyne.NewSize(480, 300))

	summaryLabel := widget.NewLabel("Summary")
	summaryBox := widget.NewRichTextWithText("")
	summaryBoxScroller := container.NewScroll(summaryBox)
	summaryBoxScroller.SetMinSize(fyne.NewSize(480, 300))

	desLabel := widget.NewLabel("Description")
	descBox := widget.NewRichTextWithText("")
	descBoxScroller := container.NewScroll(descBox)
	descBoxScroller.SetMinSize(fyne.NewSize(480, 300))

	cardStack := container.NewVBox(summaryLabel, summaryBoxScroller, desLabel, descBoxScroller)
	viewCard := widget.NewCard("", "", cardStack)

	newButton := widget.NewButton("New Jira", func() {})
	commentButton := widget.NewButton("Add Comment", func() {})
	buttons := container.NewGridWithRows(1, newButton, layout.NewSpacer(), commentButton)
	buttonCenter := container.NewCenter(buttons)

	if jiraClient == nil {
		jiraClient = jira.NewClient(settings.JiraUrl)
	}

	jiraList := widget.NewList(
		func() int { return len(jiraCards) },
		func() fyne.CanvasObject { return widget.NewLabel("") },
		func(id widget.ListItemID, object fyne.CanvasObject) {
			object.(*widget.Label).SetText(fmt.Sprintf("%s: %s", jiraCards[id].Key, jiraCards[id].Fields.Summary))
		})
	jiraList.OnSelected = func(id widget.ListItemID) {
		b.selectedJira = jiraCards[id]
		viewCard.SetTitle(jiraCards[id].Id)
		viewCard.SetSubTitle(jiraCards[id].Fields.Summary)
		summaryBox.ParseMarkdown(jiraCards[id].Fields.Summary)
		descBox.ParseMarkdown(jiraCards[id].Fields.Description)
	}
	jiraScroller.Content = jiraList

	jiraContainer = container.NewBorder(jiraScroller, buttonCenter, nil, nil, viewCard)

	jiraCards, jiraErr = jiraClient.QueryJql("")
	if jiraErr != nil {
		jiraErrBox.ParseMarkdown(fmt.Sprintf("failed to load jira cards - %+v", jiraErr))
		return
	}
	jiraList.Refresh()
	return
}

Fyne version

v2.3.3

Go compiler version

1.18.6

Operating system and version

MacOS 13.3 Ventura

Additional Information

Screenshot 2023-05-08 at 12 51 41 PM

Screenshot 2023-05-08 at 12 52 44 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    unverifiedA bug that has been reported but not verified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions