After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 729611 - Segfault at exit when calling WebKit2.WebContext.register_uri_scheme
Segfault at exit when calling WebKit2.WebContext.register_uri_scheme
Status: RESOLVED NOTGNOME
Product: gjs
Classification: Bindings
Component: general
1.40.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2014-05-06 02:06 UTC by Philip Chimento
Modified: 2017-03-15 22:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Philip Chimento 2014-05-06 02:06:02 UTC
This minimal program segfaults at exit:

const WebKit = imports.gi.WebKit2;
WebKit.WebContext.get_default().register_uri_scheme('image', function(request) {});

Looks to be something wrong in the GC, but I'm not familiar enough with that part of GJS to figure out what's going on.

Backtrace below:

Program received signal SIGSEGV, Segmentation fault.
Gtk-Message: Failed to load module "canberra-gtk-module"
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
0xb6e8f3c4 in ?? () from /usr/lib/i386-linux-gnu/libmozjs-24.so.0
(gdb) bt
  • #0 ??
    from /usr/lib/i386-linux-gnu/libmozjs-24.so.0
  • #1 js_RemoveRoot(JSRuntime*, void*)
    from /usr/lib/i386-linux-gnu/libmozjs-24.so.0
  • #2 JS_RemoveValueRoot(JSContext*, JS::Value*)
    from /usr/lib/i386-linux-gnu/libmozjs-24.so.0
  • #3 gjs_callback_trampoline_unref
    from /usr/lib/libgjs.so.0
  • #4 ??
    from /usr/lib/libgjs.so.0
  • #5 ??
    from /usr/lib/i386-linux-gnu/libwebkit2gtk-3.0.so.25
  • #6 ??
    from /usr/lib/i386-linux-gnu/libwebkit2gtk-3.0.so.25
  • #7 g_object_unref
    at gobject.c line 3112
  • #8 ??
    from /usr/lib/i386-linux-gnu/libwebkit2gtk-3.0.so.25
  • #9 __run_exit_handlers
    at exit.c line 77
  • #10 __GI_exit
    at exit.c line 99
  • #11 main

Comment 1 Giovanni Campagna 2014-05-06 10:16:55 UTC
Stupid webkit registers at atexit handler and calls into JS code long after the runtime is gone...
Comment 2 Philip Chimento 2014-05-06 16:15:02 UTC
I see... and use of atexit() is deprecated in GObject libraries. What's the usual pattern for replacing this?
Comment 3 Giovanni Campagna 2014-05-06 16:16:35 UTC
(In reply to comment #2)
> I see... and use of atexit() is deprecated in GObject libraries. What's the
> usual pattern for replacing this?

Do nothing and let the kernel take care of freeing the memory?
Comment 4 Jasper St. Pierre (not reading bugmail) 2015-05-18 20:58:28 UTC
yeah, not our bug. webkit is dumb.
Comment 5 Philip Chimento 2017-03-15 22:18:49 UTC
For the paper trail, here's the Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=116672