GNOME Bugzilla – Bug 683952
ClutterInterval constractor get Segmentation fault
Last modified: 2012-09-14 12:14:57 UTC
I wrote Gjs code below, #! /usr/bin/env gjs const Clutter = imports.gi.Clutter; Clutter.init(null); let interval = new Clutter.Interval({value_type:{}}); I ran with gjs and get SIGSEGV. $ ./SEGV.js Segmentation fault I hope to know how to create ClutterInterval object.
if you put random stuff for arguments, you'll probably get a segfault somewhere. Bugzilla is also not a help forum; if you want to get help on using GNOME libraries through JavaScript, you can subscribe to javascript-list: https://mail.gnome.org/mailman/listinfo/javascript-list creating ClutterInterval instances from language bindings is not entirely recommended: the language binding needs to understand what a GValue is, given that the API for ClutterInterval is either not introspectable (due to the usage of variadic arguments) or based on GValue. nevertheless, this works for me: gjs> const GObject = imports.gi.GObject; gjs> const Clutter = imports.gi.Clutter; gjs> let i = new Clutter.Interval({ 'value-type': GObject.TYPE_INT }); gjs> i.set_initial(0); gjs> i.set_final(100); you can call compute() to get the interpolated value, e.g.: gjs> i.compute(0.0); 0 gjs> i.compute(1.0); 100 gjs> i.compute(0.5); 50 you may have issues with Clutter 1.10 if you try using floating point values, given that the Interval started doing value transformations only during the 1.11 development cycle.
Thank you for your reply, and I understand GObject usage. I am sorry to intrude on your precious time. I am now using clutter-1.11.12, and gjs-1.33.9, and above codes work fine. I'll ask some changes (actor rotation usage, etc) on javascript-list, if I will not be able to understand new features. Thank you ever so much.