ensure data doesn't get garbage collected too soon (#1113)

* ensure data doesn't get garbage collected too soon

* Update v2/internal/frontend/desktop/linux/frontend.go

Co-authored-by: stffabi <stffabi@users.noreply.github.com>

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
This commit is contained in:
Travis McLane
2022-01-28 07:37:17 +11:00
committed by GitHub
co-authored by Lea Anthony stffabi
parent ac69577182
commit e713c439f0
@@ -366,6 +366,7 @@ func (f *Frontend) processRequest(request unsafe.Pointer) {
cMimeType := C.CString(mimeType)
defer C.free(unsafe.Pointer(cMimeType))
cLen := C.long(len(content))
stream := C.g_memory_input_stream_new_from_data(unsafe.Pointer(cContent), cLen, nil)
stream := C.g_memory_input_stream_new_from_data(unsafe.Pointer(C.g_strdup(cContent)), cLen, C.g_free)
C.webkit_uri_scheme_request_finish(req, stream, cLen, cMimeType)
C.g_object_unref(C.gpointer(stream))
}