sourcegraph/go-webkit2 — pull request #11 by mdimec4 (2014-05-15 07:29:23+00:00)
Title: GAsyncReadyCallback GarbageCollector bug correction and a few other improvments.

Hi

I have experienced many crashes connected with GAsyncReadyCallback like this one:
http://pastebin.com/ybgWswdU ( Notice 0xdeaddeaddeaddead pointer.)
So I have prepared a solution for the problem and I want to share it with you.

If you look at: https://github.com/sourcegraph/go-webkit2/blob/master/webkit2/gasyncreadycallback.go and https://github.com/sourcegraph/go-webkit2/blob/master/webkit2/webview.go you will see the problem:
1. Callback variable from GetSnapshot or RunJavaScript goes out of Go runtime view. The only reference that remains to it is inside the C world of gtkwebkit2.
2. Go GC may collect callback function since it is not referenced by a runtime. Callback becomes [Dangling pointer](http://en.wikipedia.org/wiki/Dangling_pointer)
3. gtkwebkit2 calls _go_gasyncreadycallback_call(), which treys to call callback, which have been removed by GC before. 0xdeaddeaddeaddead pointer and crash