Fix webkit_web_view_run_javascript() callback signature
Don't use wrong types and then cast the function pointer to the right type, but just use the correct type from the beginning. Also make the callback extern "C", as it should be, to be called from C code.
This commit is contained in:
parent
b0d2375941
commit
9d6bd9a52d
@ -1099,17 +1099,21 @@ wxString wxWebViewWebKit::GetPageText() const
|
||||
return wxString();
|
||||
}
|
||||
|
||||
static void wxgtk_run_javascript_cb(WebKitWebView *,
|
||||
GAsyncResult *res,
|
||||
GAsyncResult **res_out)
|
||||
extern "C"
|
||||
{
|
||||
|
||||
static void wxgtk_run_javascript_cb(GObject *,
|
||||
GAsyncResult *res,
|
||||
void *user_data)
|
||||
{
|
||||
// Ensure that it doesn't get freed by the time we use it in
|
||||
// RunScriptSync() itself.
|
||||
g_object_ref(res);
|
||||
|
||||
GAsyncResult** res_out = static_cast<GAsyncResult**>(user_data);
|
||||
*res_out = res;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
// Run the given script synchronously and return its result in output.
|
||||
bool wxWebViewWebKit::RunScriptSync(const wxString& javascript, wxString* output)
|
||||
{
|
||||
@ -1117,7 +1121,7 @@ bool wxWebViewWebKit::RunScriptSync(const wxString& javascript, wxString* output
|
||||
webkit_web_view_run_javascript(m_web_view,
|
||||
javascript,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)wxgtk_run_javascript_cb,
|
||||
wxgtk_run_javascript_cb,
|
||||
&result);
|
||||
|
||||
GMainContext *main_context = g_main_context_get_thread_default();
|
||||
|
Loading…
Reference in New Issue
Block a user