-
Notifications
You must be signed in to change notification settings - Fork 61
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
cgo blows up with runtime error: cgo argument has Go pointer to Go pointer
#33
Comments
Ah, this is likely a gotk bug, I'll pass that along. |
Nevermind this is go-webkit2 bug. Sorry for the noise. |
One possible fix may be to do: index 3f79cc0..638db8b 100644
--- a/webkit2/gasyncreadycallback.go
+++ b/webkit2/gasyncreadycallback.go
@@ -25,6 +25,8 @@ func newGAsyncReadyCallback(f interface{}) (cCallback C.GAsyncReadyCallback, use
if rf.Kind() != reflect.Func {
return nil, nil, errors.New("f is not a function")
}
- cbinfo := &garCallback{rf}
+ data := C.malloc(C.size_t(unsafe.Sizeof(garCallback{})))
+ cbinfo := (*garCallback)(data)
+ cbinfo.f = rf
return C.GAsyncReadyCallback(C._gasyncreadycallback_call), C.gpointer(unsafe.Pointer(cbinfo)), nil
} diff --git a/webkit2/webview.go b/webkit2/webview.go
index 8249757..5da804a 100644
--- a/webkit2/webview.go
+++ b/webkit2/webview.go
@@ -125,6 +125,7 @@ func (v *WebView) RunJavaScript(script string, resultCallback func(result *gojs.
var err error
if resultCallback != nil {
callback := func(result *C.GAsyncResult) {
+ C.free(unsafe.Pointer(userData))
var jserr *C.GError
jsResult := C.webkit_web_view_run_javascript_finish(v.webView, result, &jserr)
if jsResult == nil { (And so forth) |
Closed in #35 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://groups.google.com/forum/#!searchin/golang-nuts/cgo$20argument$20has$20Go$20pointer$20to$20Go$20pointer/golang-nuts/gnH0nhPf36I/4Shly3gxEwAJ
golang/go#12416
The text was updated successfully, but these errors were encountered: