mattn / go-gtk

Go binding for GTK
http://mattn.github.com/go-gtk
BSD 3-Clause "New" or "Revised" License
2.11k stars 247 forks source link

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

Open jinj opened 3 years ago

mattn commented 3 years ago

please provide minimal code to reproduce.

jinj commented 3 years ago

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 notifications@github.com 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 .