diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index 59fa602c63..ff5076fffc 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -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(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();