Setting tag stm freezes textwindow



This function should insert one line of text and tag it with "the_tag".
Tag is set, it just colors the text. Problem is, that the function stm
cause the text_window to freeze. This problem usually happens after
10times called. Also I sometimes get g_utf8_validate error, dunno why :(


GtkTextIter end_it, start_it;
// get iterator
gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(text_buffer),&start_it);
gtk_text_buffer_insert(text_buffer,&start_it,the_text,strlen(the_text));
// set tag
gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(text_buffer),&end_it);
gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(text_buffer),&start_it);
gtk_text_iter_backward_line(&start_it);
gtk_text_iter_forward_line(&end_it);
gtk_text_buffer_apply_tag(text_buffer,the_tag,&start_it,&end_it);


Line is always add to start iter. What should be a problem?







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]