Bug 233997

Summary: Connecting to context menu signal leads to segfault
Product: WebKit Reporter: Jan <EvilTwin1>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: bugs-noreply, EvilTwin1, mcatanzaro, webkit-bug-importer
Priority: P2    
Version: Other   
Hardware: PC   
OS: Linux   

Description Jan 2021-12-08 02:25:19 PST
I'm using the rust bindings to the Gtk4 version of webkit2gtk. I used them with both a local build of webkit as well as with the version in the org.gnome.Sdk flatpak runtime.
Connecting to the context-menu signal leads to a segmentation fault.

> GLib-GObject-WARNING **: 08:53:00.267: value_to_ffi_type: Unsupported fundamental type: GdkEvent Segmentation fault (core dumped)

Asking about it in the "Rust <3 Gnome" Matrix channel it was explained to me that this is an issue with webkit itself:

> slomo:
> value_to_ffi_type() is the libffi signal marshaller thingy from glib, and that can't handle custom fundamental types (i mean, that's what it says there 🙂 )
> the Rust code is probably correct but webkitgtk will have to use a customer marshaller for that signal
> it needs to do things like here https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gdk/gdksurface.c#L647-660
> important in that context is also the type annotation here https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gdk/gdksurface.c#L641


> Emmanuele Bassi:
> Correct. Events are instance types, and there’s no marshaller for those because GType is stupid
> You need to provide a marshaller yourself
> Though I’d recommend not passing around event instances to begin with

I don't feel confident to prepare a patch to webkit myself. But I hope this report provides enough information.
Comment 1 Michael Catanzaro 2021-12-15 06:47:34 PST

*** This bug has been marked as a duplicate of bug 233785 ***