GNOME Bugzilla – Bug 651892
gjs fails when accessing fixed size array elements through gobject-introspection
Last modified: 2017-01-06 04:41:17 UTC
Created attachment 189241 [details] [review] gnome-shell-extensions patch that causes the system-monitor crash Hi there, So working on a system-monitor extension for I tried accessing glibtop_cpu's xcpu_total array and tried to return the first element, but got a segfault instead of the value I was after. The easiest way to reproduce this is with the systemMonitor extension from gnome-shell-extensions (commit 31ee462a0b6ed8414361ccb6c1c6ca861bd7c2f8), with the attached patch. The version of gjs I'm using is commit 39cf5d2f51dcad72a7e175f21a3ffe602b5dd4b3, everything else should be about version 3.0.2, but I'm happy to provide specifics if required. I've managed to setup debugging, although not by "gnome-shell --replace -g" (since -g was an unknown option), not by "gdb gnome-shell > run --replace", since it warned of an already running compositing window manager. Eventually I slid gdbserver into the startup process and the tapped it that way. The following is the backtrace I got. Please let me know if you need any further information... (gdb) bt
+ Trace 227379
Hi, Can you provide: 1. gobject-itrospection version 2. machine architecture type (x86 or x86_64) 3. xulrunner version ?
Yep, 1. gobject-introspection-0.10.8 2. x86_64 (I don't yet have an x86 system I can test it on) 3. xulrunner-2.0.1 These are all Gentoo built source packages, no special flags (other than -ggdb). I'm more than happy to provide more information and/or test run scripts or programs if it'll help track down the problem?
I think, gobject-introspection is too old. Can you reproduce this bug with current trunk version?
Hmmm, I'm having difficult building from master, it seems to require glib-types.h which glib-2.28.7 doesn't seem to provide. I'll keep trying and see where I can get to, otherwise I'll have to verify this after the next gobject-introspection release...
Yep, looks like it was a recent (early April) change made to glib related to bug 646635. I'm not keen to start testing glib-2.29 on my production system, so I'm afraid this will have to wait. I'm happy for it to be marked as closed or later, and then reopen it if I still have the problems after the new glib/gobject-introspection come out...
I believe this is fixed now, the following script succeeds for me (and prints out 64 integers): const GTop = imports.gi.GTop; let cpu = new GTop.glibtop_cpu(); GTop.glibtop_get_cpu(cpu); print(cpu.xcpu_total); If the extension still doesn't work for you, feel free to reopen the bug.