[Webkit-unassigned] [Bug 167495] New: [GTK] Confusing webkit_uri_scheme_request_finish_error() description

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 27 02:47:10 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=167495

            Bug ID: 167495
           Summary: [GTK] Confusing
                    webkit_uri_scheme_request_finish_error() description
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Gtk
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcrha at redhat.com
                CC: bugs-noreply at webkitgtk.org, tpopela at redhat.com

I just found out in one of my valgrind logs this:

==8106== 52 (32 direct, 20 indirect) bytes in 2 blocks are definitely lost in loss record 22,849 of 44,246
==8106==    at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==8106==    by 0x6AC229E: g_malloc (gmem.c:94)
==8106==    by 0x6ADC406: g_slice_alloc (gslice.c:1025)
==8106==    by 0x6AA2767: g_error_new_literal (gerror.c:471)
==8106==    by 0x969D47F: web_view_process_uri_request_cb (e-web-view.c:1103)
==8106==    by 0x751FB15: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x753BB54: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x753B7D4: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x75B4B51: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x75B4778: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x72B4168: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x73AB521: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x72B02C5: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x72B0F57: ??? (in /usr/lib64/libwebkit2gtk-4.0.so.37.14.9)
==8106==    by 0x1120EB9C: WTF::RunLoop::performWork() (in /usr/lib64/libjavascriptcoregtk-4.0.so.18.4.9)
==8106==    by 0x11235588: ??? (in /usr/lib64/libjavascriptcoregtk-4.0.so.18.4.9)
==8106==    by 0x6AB9C0B: g_main_dispatch (gmain.c:3203)
==8106==    by 0x6ABAABC: g_main_context_dispatch (gmain.c:3856)
==8106==    by 0x6ABACA1: g_main_context_iterate (gmain.c:3929)
==8106==    by 0x6ABB0C8: g_main_loop_run (gmain.c:4125)
==8106==    by 0x5D577E4: gtk_main (gtkmain.c:1301)
==8106==    by 0x404CB7: main (main.c:667)

This newly created GError instance is passed to the webkit_uri_scheme_request_finish_error(), which takes a non-const GError structure pointer and claims in the documentation:
/**
 * webkit_uri_scheme_request_finish_error:
 * @request: a #WebKitURISchemeRequest
 * @error: a #GError that will be passed to the #WebKitWebView
 *
 * Finish a #WebKitURISchemeRequest with a #GError.
 *
 * Since: 2.2
 */

that the GError will be passed somewhere. I'd understand from it that the function takes ownership of the @error, the parameter type suggests the same (as being non-const), but when I checked the implementation the @error is only dereferenced and its values are copied to some other structures, and even that not always.

I suggest to make the @error a 'const GError *error' parameter of the function and eventually also write a note into the documentation that the 'error' is not taken by the function (which would be understood by the 'const' on its own).

Opinions?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170127/a7ceedde/attachment.html>


More information about the webkit-unassigned mailing list