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 683952 - ClutterInterval constractor get Segmentation fault
ClutterInterval constractor get Segmentation fault
Status: RESOLVED NOTABUG
Product: clutter
Classification: Platform
Component: ClutterAction
1.11.x
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-09-13 13:05 UTC by Nishio Futoshi
Modified: 2012-09-14 12:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nishio Futoshi 2012-09-13 13:05:53 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.
Comment 1 Emmanuele Bassi (:ebassi) 2012-09-13 14:59:40 UTC
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.
Comment 2 Nishio Futoshi 2012-09-14 12:14:57 UTC
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.