RESOLVED FIXED 20940
[GTK] use of confirm dialog (yes/no) causes segfault
https://bugs.webkit.org/show_bug.cgi?id=20940
Summary [GTK] use of confirm dialog (yes/no) causes segfault
Luke Kenneth Casson Leighton
Reported 2008-09-19 09:57:03 PDT
the gboolean pointer into which the yes/no result is to be placed appears to be corrupt - see attached gdb typescript.
Attachments
gdb trace, disas and $rip (12.03 KB, text/plain)
2008-09-19 09:57 PDT, Luke Kenneth Casson Leighton
no flags
we marshal the didConfirm parameter to a boolean not to a pointer (3.70 KB, patch)
2009-03-11 04:13 PDT, Jan Alonzo
no flags
change the marshaller instead (1.89 KB, patch)
2009-03-11 12:26 PDT, Jan Alonzo
zecke: review+
Luke Kenneth Casson Leighton
Comment 1 2008-09-19 09:57:57 PDT
Created attachment 23570 [details] gdb trace, disas and $rip
Jan Alonzo
Comment 2 2009-03-11 04:13:42 PDT
Created attachment 28472 [details] we marshal the didConfirm parameter to a boolean not to a pointer
Holger Freyther
Comment 3 2009-03-11 06:41:07 PDT
aeh, didConfirm looks like an out pointer (on first sight), are you sure about this change vs. changing the marshaling?
Christian Dywan
Comment 4 2009-03-11 11:31:10 PDT
> -static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* > message, gboolean* didConfirm, gpointer data) > +static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* > message, gboolean didConfirm, gpointer data) > { > fprintf(stdout, "CONFIRM: %s\n", message); > - *didConfirm = TRUE; > + didConfirm = TRUE; > return TRUE; > } This is bogus if I may say that. Assigning a value to a local variable doesn't do anything at all. If anything, the marshaller must be wrong. didConfirm represents the action of the user, ie. did confirm or did not confirm.
Jan Alonzo
Comment 5 2009-03-11 12:26:41 PDT
Created attachment 28487 [details] change the marshaller instead
Jan Alonzo
Comment 6 2009-03-14 16:15:14 PDT
Landed in r41706. Thanks!
Johan Dahlin
Comment 7 2009-03-15 12:02:48 PDT
(In reply to comment #4) > > -static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* > message, gboolean* didConfirm, gpointer data) > > +static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* > message, gboolean didConfirm, gpointer data) > > { > > fprintf(stdout, "CONFIRM: %s\n", message); > > - *didConfirm = TRUE; > > + didConfirm = TRUE; > > return TRUE; > > } > > This is bogus if I may say that. Assigning a value to a local variable doesn't > do anything at all. If anything, the marshaller must be wrong. > > didConfirm represents the action of the user, ie. did confirm or did not > confirm. > This doesn't look quite right. It won't be possible to support this pattern in language bindings. Why not just use the return value and remove the third argument to the callbacks instead of always returning TRUE?
Christian Dywan
Comment 8 2009-03-15 12:49:34 PDT
(In reply to comment #7) > (In reply to comment #4) > > > -static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* > message, gboolean* didConfirm, gpointer data) > > > +static gboolean webViewScriptConfirm(WebKitWebView* view, WebKitWebFrame* frame, const gchar* > message, gboolean didConfirm, gpointer data) > > > { > > > fprintf(stdout, "CONFIRM: %s\n", message); > > > - *didConfirm = TRUE; > > > + didConfirm = TRUE; > > > return TRUE; > > > } > > > > This is bogus if I may say that. Assigning a value to a local variable doesn't > > do anything at all. If anything, the marshaller must be wrong. > > > > didConfirm represents the action of the user, ie. did confirm or did not > > confirm. > > > > This doesn't look quite right. It won't be possible to support this pattern in > language bindings. Why not just use the return value and remove the third > argument to the callbacks instead of always returning TRUE? Because the return value determines whether the signal was handled or not.
Note You need to log in before you can comment on or make changes to this bug.