webview/webview_go

nil pointer deref when using dispatch

Le0Developer opened this issue · 0 comments

Getting a nil pointer deref here:

f()

I have no idea how to reproduce this, I've been getting this for months randomly and I can't narrow it down or reproduce consistently.

We use webview.Dispatch to evaluate code that sends RPC responses to JS land (we built our own RPC ontop of webview RPC because we needed async procedures).
This works without issues 99.999% of time, until it doesn't and crashes.

According to our observations, this might be related to navigations? We do "reloadless" navigations in our SPA and crashes seem to happen frequently imminently before/after one.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x7ff62432dbcd]

goroutine 1 [running, locked to thread]:
github.com/webview/webview_go._webviewDispatchGoCallback(0xc8)
        C:/Users/runneradmin/go/pkg/mod/github.com/webview/webview_go@v0.0.0-20230901181450-5a14030a9070/webview.go:217 +0xad
github.com/webview/webview_go._Cfunc_webview_run(0x15d0933d130)
        _cgo_gotypes.go:238 +0x49
github.com/webview/webview_go.(*webview).Run.func1(0xc00009fcb8?)
        C:/Users/runneradmin/go/pkg/mod/github.com/webview/webview_go@v0.0.0-20230901181450-5a14030a9070/webview.go:157 +0x34
github.com/webview/webview_go.(*webview).Run(0xc00007e630?)
        C:/Users/runneradmin/go/pkg/mod/github.com/webview/webview_go@v0.0.0-20230901181450-5a14030a9070/webview.go:157 +0x13
// .... our code that just calls Run