go-gtk icon indicating copy to clipboard operation
go-gtk copied to clipboard

glib.IdleAdd crashed with panic: reflect: Call using reflect.Value as type string

Open jinj opened this issue 4 years ago • 2 comments

jinj avatar Oct 11 '20 15:10 jinj

please provide minimal code to reproduce.

mattn avatar Oct 11 '20 15:10 mattn

I just figured out. If I define a function like:

func (btn* MyButton) SetLabel(label string) { ... } Then call it as: glib.IdleAdd(btn.SetLabel, "new label")

It will crash.

Then I changed the function to: func (btn* MyButton) SetLabel(data reflect.Value) { str := data.String() ... }

Then it works.

On Sun, Oct 11, 2020 at 11:48 AM mattn [email protected] wrote:

please provide minimal code to reproduce.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattn/go-gtk/issues/417#issuecomment-706724566, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABN7NRIJIAX4S73OXHXDYGDSKHHTXANCNFSM4SL25P7Q .

jinj avatar Oct 13 '20 00:10 jinj