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: runtime error: cgo argument has Go pointer to Go pointer #1

Open
mewmew opened this issue Mar 14, 2016 · 0 comments
Open

panic: runtime error: cgo argument has Go pointer to Go pointer #1

mewmew opened this issue Mar 14, 2016 · 0 comments

Comments

@mewmew
Copy link
Member

mewmew commented Mar 14, 2016

Does anyone know more about the new rules for sharing pointers between Go and C? If so, please give us a hand at resolving this issue.

(ref golang/go#12416)

Offending code from cmd/gpsview/gpsview.go:

    onButtonPress := func(ctx *glib.CallbackContext) {
        arg := ctx.Args(0)
        ev := (*gdk.EventButton)(unsafe.Pointer(arg))
        coord := m.ScreenToCoord(int(ev.X), int(ev.Y))
$ go vet ./cmd/gpsview
cmd/gpsview/gpsview.go:172: possible misuse of unsafe.Pointer
exit status 1
$ gpsview
panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 1 [running]:
panic(0x5b0480, 0xc82000a4f0)
    /home/u/go/src/runtime/panic.go:500 +0x18e
github.com/mattn/go-gtk/gtk._cgoCheckPointer0(0x59d6c0, 0xc820010300, 0xc82000a4e0, 0x1, 0x1, 0xc82000a4c4)
    ??:0 +0x49
github.com/mattn/go-gtk/gtk.Init(0x8fdcc0)
    /home/u/goget/src/github.com/mattn/go-gtk/gtk/gtk.go:228 +0x2cc
main.main()
    /home/u/Desktop/go/src/github.com/mewmew/gtkmap/cmd/gpsview/gpsview.go:116 +0x29e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant