Bug 188597 - [GTK] Segmentation fault when creating an instance of WebKitFindController without a WebKitWebView
Summary: [GTK] Segmentation fault when creating an instance of WebKitFindController wi...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-15 02:42 PDT by Hishy1950
Modified: 2018-08-15 08:56 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hishy1950 2018-08-15 02:42:20 PDT
Hello.
When I try to create a new instance of FindController my application exixts with segmentation fault.

I am using Python bindings like this:

import gi

from gi.repository import GObject, Gtk, Gdk, WebKit2 as webkit

self.find_controller = webkit.FindController()


My litwebkitgtk version is 2.20.3.

Thank you.
Comment 1 Michael Catanzaro 2018-08-15 08:37:45 PDT
Please post a backtrace
Comment 2 Michael Catanzaro 2018-08-15 08:48:27 PDT
Well, actually since your example was so simple/good, I just got one myself:

(gdb) bt full
#0  0x00007fec0dfafe54 in WTF::DumbPtrTraits<WebKit::WebPageProxy>::unwrap(WebKit::WebPageProxy* const&) (ptr=<optimized out>)
    at /usr/src/debug/webkit2gtk3-2.20.4-1.fc28.x86_64/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:1339
#1  0x00007fec0dfafe54 in WTF::RefPtr<WebKit::WebPageProxy, WTF::DumbPtrTraits<WebKit::WebPageProxy> >::get() const (this=<optimized out>)
    at /usr/src/debug/webkit2gtk3-2.20.4-1.fc28.x86_64/x86_64-redhat-linux-gnu/DerivedSources/ForwardingHeaders/wtf/RefPtr.h:72
#2  0x00007fec0dfafe54 in webkitWebViewBaseGetPage(_WebKitWebViewBase*) (webkitWebViewBase=0x0)
    at /usr/src/debug/webkit2gtk3-2.20.4-1.fc28.x86_64/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:1339
#3  0x00007fec0df93a59 in getPage (webView=<optimized out>)
    at /usr/src/debug/webkit2gtk3-2.20.4-1.fc28.x86_64/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:1983
#4  0x00007fec0df93a59 in webkitWebViewGetPage(_WebKitWebView*) (webView=<optimized out>)
    at /usr/src/debug/webkit2gtk3-2.20.4-1.fc28.x86_64/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:1983
#5  0x00007fec0df73d14 in getPage (findController=0x560f837a6820 [WebKitFindController])
    at /usr/src/debug/webkit2gtk3-2.20.4-1.fc28.x86_64/Source/WebKit/UIProcess/API/glib/WebKitFindController.cpp:140
        findController = 0x560f837a6820 [WebKitFindController]
#6  0x00007fec0df73d14 in webkitFindControllerConstructed(GObject*) (object=<optimized out>)
    at /usr/src/debug/webkit2gtk3-2.20.4-1.fc28.x86_64/Source/WebKit/UIProcess/API/glib/WebKitFindController.cpp:140
        findController = 0x560f837a6820 [WebKitFindController]
#7  0x00007fec28c578fb in g_object_new_internal (class=class@entry=0x560f837e9260, params=params@entry=0x0, n_params=n_params@entry=0) at gobject.c:1839
        nqueue = 0x560f837c6ba0
        object = 0x560f837a6820 [WebKitFindController]
        __func__ = "g_object_new_internal"
#8  0x00007fec28c5916d in g_object_newv (object_type=94624630607200, n_parameters=n_parameters@entry=0, parameters=parameters@entry=0x0) at gobject.c:2036
        class = 0x560f837e9260
        unref_class = 0x0
        object = <optimized out>
        __func__ = "g_object_newv"
#9  0x00007fec290dd38c in pygobject_constructv (self=self@entry=0x7fec1ce60c60, n_parameters=0, parameters=0x0) at gobjectmodule.c:1000
        obj = <optimized out>
        __func__ = "pygobject_constructv"
#10 0x00007fec290e4ed9 in pygobject_init (self=self@entry=0x7fec1ce60c60, args=args@entry=<unknown at remote 0x7fec3724b048>, kwargs=kwargs@entry=0x0)
   ect-object.c:1305
        object_type = <optimized out>
        n_params = 0
        i = <optimized out>
        params = 0x0
        class = 0x560f837e9260
#11 0x00007fec36c9de42 in type_call (type=<optimized out>, args=<unknown at remote 0x7fec3724b048>, kwds=0x0) at /usr/src/debug/python3-3.6.6-1.fc28.x86_64/Objects/typeobject.c:915
        res = <optimized out>
        obj = <unknown at remote 0x7fec1ce60c60>
#12 0x00007fec36c2f81b in _PyObject_FastCallDict (func=<unknown at remote 0x560f837e8e98>, args=0x560f83534ae8, nargs=<optimized out>, kwargs=0x0)
    at /usr/src/debug/python3-3.6.6-1.fc28.x86_64/Objects/abstract.c:2331
        tuple = <unknown at remote 0x7fec3724b048>
        call = 0x7fec36c9ddd0 <type_call>
        result = 0x0
#13 0x00007fec36c9dd38 in _PyObject_FastCallKeywords (func=<unknown at remote 0x560f837e8e98>, stack=<optimized out>, nargs=0, kwnames=<optimized out>)
    at /usr/src/debug/python3-3.6.6-1.fc28.x86_64/Objects/abstract.c:2482
        kwdict = <optimized out>
        result = <optimized out>
        nkwargs = <optimized out>
#14 0x00007fec36cacd41 in call_function (pp_stack=0x7ffc4b6e8988, oparg=0, kwnames=0x0)
    at /usr/src/debug/python3-3.6.6-1.fc28.x86_64/Python/ceval.c:4854
        pfunc = 0x560f83534ae0
        func = <unknown at remote 0x560f837e8e98>
        x = <optimized out>
        w = <optimized out>
        nargs = 0
        stack = <optimized out>
Python Exception <class 'gdb.error'> Dwarf Error: could not find partial DIE containing offset 0x316 [in module /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug]:
Comment 3 Michael Catanzaro 2018-08-15 08:56:37 PDT
The problem is you didn't pass a WebKitWebView property. You're not really intended to create WebKitFindController yourself, but rather to get it from a WebKitWebView using webkit_web_view_get_find_controller().

Anyway, of course we should assert or emit a critical or something instead of crashing. My first instinct would be g_return_val_if_fail(), but there's no place where that would be possible. I guess we could add a g_assert() in webkitFindControllerConstructed, but that's not really a friendly way to signal API misuse. Not sure what we should do here.