Hi, all:

I write a test demo, use clutter_actor_get_width() get actor width, it is 
correct
if in the main thread call, but incorrect in then new thread.
used  clutter-1.6.20 and pango-1.28.4 and glib2-2.28.6

Pango:ERROR:pango-layout.c:3743:pango_layout_check_lines: assertion failed: 
(!layout->log_attrs)
The code is what problem? have any error?  Tks.

#include <glib.h>
#include <clutter/clutter.h>
ClutterActor *gStage, *acttext=NULL;
ClutterColor white = {255, 255, 255, 255};
ClutterColor black = {0, 0, 0, 0};

static gpointer test(gpointer data)
{
gfloat ww;
if (acttext)
clutter_container_remove_actor(CLUTTER_CONTAINER(gStage), acttext);
acttext = clutter_text_new_full("Monospace 20", (gchar*)data , &white);
clutter_text_set_single_line_mode(CLUTTER_TEXT(acttext), TRUE);
clutter_container_add_actor(CLUTTER_CONTAINER(gStage), acttext);
clutter_actor_set_position(acttext, 100, 100); 

//why not get width
//if use clutter_actor_get_width(acttext); 
//Pango:ERROR:pango-layout.c:3743:pango_layout_check_lines: assertion failed: 
(!layout->log_attrs)
clutter_actor_get_width(acttext); 
g_print("act width: %d \n", acttext);

}

int main(int argc, char* argv[])
{
GThread *threadid;
gchar text[128];
g_thread_init(NULL);
clutter_threads_init();
clutter_init(&argc, &argv);

gStage = clutter_stage_get_default();
clutter_actor_set_size(gStage, 600, 400);
clutter_stage_set_color(CLUTTER_STAGE(gStage), &black);
clutter_actor_show(gStage);
sprintf(text, "TEST TEST TEST TEST");
threadid = g_thread_create(test, (gpointer)text, FALSE, NULL);

clutter_main();

}

--------------
david.sale.75
_______________________________________________
clutter-app-devel-list mailing list
clutter-app-devel-list@clutter-project.org
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to