Bug 81977

Summary: WebKitWebView signals with GError parameters cause crashes when using GObject Introspection
Product: WebKit Reporter: Gary Kramlich <grim>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: gustavo, mrobinson, pnormand, rakuco
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch mrobinson: review+, mrobinson: commit-queue-

Description Gary Kramlich 2012-03-22 15:24:59 PDT
If you connect to the WebKetWebView::load-error or WebKitWebView::resource-load-error signals when using WebKit-3.0.typelib your program will crash upon signal emission for those 2 signals with the following error:

CRITICAL **: Converting of type 'void' is not implemented

This is because the closures for both signals call out the GError parameter as a pointer when it should be specified as a GBoxed type.  For reference, GError was made a boxed type in Gtk 2.26.

There should be no issues with existing C/C++ code since the pointer that is passed from the signal is type casted back into a GError in the callback function.

I will be uploading a patch shortly which resolves the issue by adding 2 closures and changing the type's passed to g_signal_new.

I have verified the changes manually but I can provide example code if needed.
Comment 1 Gary Kramlich 2012-03-22 15:27:25 PDT
Created attachment 133364 [details]
Patch
Comment 2 Martin Robinson 2012-03-25 21:57:07 PDT
We still support versions of GTK+ older than 2.26, so I do not think we can merge this change as-is. Perhaps we could make the defintion of these signals a compile-time decision.
Comment 3 Martin Robinson 2012-03-25 21:58:21 PDT
Comment on attachment 133364 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=133364&action=review

> Source/WebKit/gtk/ChangeLog:5
> +        Added marshallers for BOOLEAN:OBJECT,STRING,BOXED and VOID:OBJECT,OBJECT,BOXED and changed the signal signatures for WebKitWebView::load-fail and WebKitWebView::resource-load-failed to use the new marshallers since GError has been a GBoxed type since Gtk 2.26.  This fixes these signals for the gobject-introspection bindings.
> +        https://bugs.webkit.org/show_bug.cgi?id=81977
> +

I really appreciate you including a ChangeLog for this change. In the future, it's better to generate the ChangeLog with Tools/Scripts/prepare-ChangeLogs and to put the long-form description below the "Revied by..." line.
Comment 4 Martin Robinson 2012-03-25 22:05:03 PDT
Comment on attachment 133364 [details]
Patch

Of course, the GLib version is the one that matters here, so this patch is fine. :)
Comment 5 Gary Kramlich 2012-03-25 22:07:05 PDT
Yeah sorry about the confusion, clearly I *meant* glib :)

Also I used "webkit-patch upload" as mentioned at http://www.webkit.org/coding/contributing.html.  I'll use the other one in the future!  Thanks.
Comment 6 Martin Robinson 2012-03-26 09:25:04 PDT
Committed r112111: <http://trac.webkit.org/changeset/112111>