From e713c439f0656b57bd77a06b27aa839058f5e99e Mon Sep 17 00:00:00 2001 From: Travis McLane Date: Thu, 27 Jan 2022 14:37:17 -0600 Subject: [PATCH] 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 Co-authored-by: Lea Anthony Co-authored-by: stffabi --- v2/internal/frontend/desktop/linux/frontend.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v2/internal/frontend/desktop/linux/frontend.go b/v2/internal/frontend/desktop/linux/frontend.go index d9dc36028..484f8e28e 100644 --- a/v2/internal/frontend/desktop/linux/frontend.go +++ b/v2/internal/frontend/desktop/linux/frontend.go @@ -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)) }