Note that there are some explanatory texts on larger screens.

plurals
  1. POCasting ClutterActor* to ClutterStage*
    text
    copied!<p>I am exploring the possibility of creating a Clutter binding for the D language ( <a href="http://d-programming-language.org/" rel="nofollow">http://d-programming-language.org/</a>) and have started by trying some simple tests using dynamic loading of libclutter. I've run into a problem that might derive from the GObject inheritance system, and I'd appreciate any help getting it figured out. Here's the rundown: using clutter_stage_get_default returns a ClutterActor* which I can use with the clutter_actor_* methods. But I always get errors or segfaults when I use the clutter_stage_* or clutter_container_* methods. Here's my test code: <a href="http://pastebin.com/nVrQ69dU" rel="nofollow">http://pastebin.com/nVrQ69dU</a></p> <p>At the clutter_container_add_actor call on line 56, I get the following error: <code>(&lt;unknown&gt;:11976): Clutter-CRITICAL **: clutter_container_add_actor: assertion 'CLUTTER_IS_CONTAINER (container)' failed</code></p> <p>In example code, I have noticed the CLUTTER_STAGE and CLUTTER_CONTAINER macros for casting (these obviously are not available to me), but as far as I could tell, they simply performed some checks, then did a plain C cast. If this is incorrect, and some Gobject type magic needs to be done on the stage pointer before casting, please let me know. Binding and using the clutter_stage_set_title or clutter_stage_set_color with <code>cast(ClutterStage*)stage</code> resulted in segmentation faults, presumably the same issue.</p> <p>EDIT: Here's a <a href="http://pastebin.com/E4LANPNF" rel="nofollow" title="stripped down example">stripped down example</a> with no external dependencies (if you're not on Linux, you'll need to replace the dl calls with your OS's equivalents). This code fails with a segfault, which according to GDB and Valgrind, is in <code>clutter_stage_set_title (in /usr/lib/libclutter-glx-1.0.so.0.600.14)</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload