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

panic when Inspect an element from an open Dialog #1449

Closed
emicklei opened this issue Jan 24, 2025 · 3 comments
Closed

panic when Inspect an element from an open Dialog #1449

emicklei opened this issue Jan 24, 2025 · 3 comments
Labels
bug Something isn't working correctly

Comments

@emicklei
Copy link

Describe the bug

Version 0.3.7

Using the example from the docs, I open a Dialog and hit Cmd+Shift+I to open the inspector.
Upon selecting an element in the Dialog, the application exits with a panic.

How to reproduce

Image

Example code

func main() {
	b := c.NewBody()
	bt := core.NewButton(b).SetText("Message")
	bt.OnClick(func(e events.Event) {
		core.MessageDialog(bt, "Something happened", "Message")
	})
	b.RunMainWindow()
}

Relevant output

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102657e10]

goroutine 40 [running]:
cogentcore.org/core/core.(*Frame).AsTree(0x14000368460?)
        <autogenerated>:1
cogentcore.org/core/core.(*TreeButton).Init.func1()
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/values.go:116 +0x44
cogentcore.org/core/tree.(*NodeBase).RunUpdaters.func1(...)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/tree/plan.go:115
cogentcore.org/core/base/tiered.(*Tiered[...]).Do(...)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/base/tiered/tiered.go:30
cogentcore.org/core/tree.(*NodeBase).RunUpdaters(0x14004068808)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/tree/plan.go:113 +0x78
cogentcore.org/core/core.(*WidgetBase).UpdateWidget(0x14004068808)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/update.go:25 +0x34
cogentcore.org/core/core.(*WidgetBase).Update.func1({0x1136c85e0, 0x14004068808}, 0x1400b65bc38?)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/update.go:61 +0x28
cogentcore.org/core/core.(*WidgetBase).Update.(*WidgetBase).WidgetWalkDown.func2({0x1136c8590?, 0x14004068808})
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/widget.go:473 +0xb8
cogentcore.org/core/tree.(*NodeBase).WalkDown(0x14003f9e008, 0x1400a55e9e0)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/tree/nodebase.go:502 +0xfc
cogentcore.org/core/core.(*WidgetBase).WidgetWalkDown(...)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/widget.go:471
cogentcore.org/core/core.(*WidgetBase).Update(0x14003f9e008)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/update.go:60 +0xb4
cogentcore.org/core/core.(*Inspector).Init.func4.1.2.2({0x103018160?, 0x14003df9770?})
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/inspector.go:90 +0xec
cogentcore.org/core/events.(*Listeners).Call(0x1400b65bdf0, {0x10310d5a8, 0x14009347880}, {0x1400b65be60, 0x1, 0x1025cb168?})
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/events/listeners.go:61 +0x100
cogentcore.org/core/core.(*WidgetBase).HandleEvent.func1(...)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/widgetevents.go:244
cogentcore.org/core/base/tiered.(*Tiered[...]).Do(...)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/base/tiered/tiered.go:30
cogentcore.org/core/core.(*WidgetBase).HandleEvent(0x14003fa0008, {0x10310d5a8, 0x14009347880})
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/widgetevents.go:243 +0x164
cogentcore.org/core/core.(*WidgetBase).Send(0x14003fa0008, 0x21, {0x0?, 0x14003f93508?, 0x103103760?})
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/widgetevents.go:180 +0x80
cogentcore.org/core/core.(*Tree).sendSelectEvent(0x14003fa5508, {0x0, 0x0, 0x0})
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/tree.go:836 +0x94
cogentcore.org/core/core.(*Tree).SelectEvent(0x14003fa5508, 0x31057b0?)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/tree.go:862 +0x3c
cogentcore.org/core/core.(*Inspector).selectionMonitor(0x14003db5508)
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/inspector.go:232 +0x14c
created by cogentcore.org/core/core.(*Inspector).toggleSelectionMode in goroutine 25
        /Users/emicklei/go/pkg/mod/cogentcore.org/[email protected]/core/inspector.go:192 +0xf4
exit status 2

Platform

macOS

@emicklei emicklei added the bug Something isn't working correctly label Jan 24, 2025
@github-project-automation github-project-automation bot moved this to Todo in Bugs Jan 24, 2025
@AnyCPU
Copy link

AnyCPU commented Jan 25, 2025

@emicklei it runs ok on master or v0.3.8.

i used following code:

package main

import (
	"cogentcore.org/core/core"
	"cogentcore.org/core/events"
)

func main() {
	b := core.NewBody()
	bt := core.NewButton(b).SetText("Message")
	bt.OnClick(func(e events.Event) {
		core.MessageDialog(bt, "Something happened", "Message")
	})
	b.RunMainWindow()
}

on latest macOS (Intel).

@emicklei
Copy link
Author

yes, works with 0.3.8

@github-project-automation github-project-automation bot moved this from Todo to Done in Bugs Jan 25, 2025
@kkoreilly
Copy link
Member

Yes, this was fixed by #1444, which was merged as part of #1321, included in v0.3.8. Thanks for pointing that out @AnyCPU.

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

No branches or pull requests

3 participants