/*
 * I compiled this with:
 *   gcc -Wall -g test.c -o example `pkg-config clutter-1.0 --cflags --libs`
 */

#include <clutter/clutter.h>

int main (int argc, char *argv[])
{
  ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
  ClutterColor rect_color = { 0xff, 0xff, 0xff, 0xff };

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  ClutterActor *stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 200, 200);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);

  ClutterActor *box = clutter_actor_new ();
  ClutterLayoutManager *layout =
      clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
  clutter_actor_set_layout_manager (box, layout);

  /* This set_size line is what causes the segfault for me */
  clutter_actor_set_size (box, 200, 200);
  clutter_actor_add_child (stage, box);

  /* It also won't crash if this rectangle isn't added */
  ClutterActor *rectangle = clutter_rectangle_new_with_color (&rect_color);
  clutter_actor_set_size (rectangle, 40, 40);
  clutter_actor_add_child (box, rectangle);

  clutter_actor_show_all (stage);

  clutter_main ();

  return 0;
}
