GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Aug 31, 2016 2:09 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Gtk Errors "unknown segment type" and ...
PostPosted: Wed Feb 15, 2012 10:04 am 
Familiar Face

Joined: Tue Jan 31, 2012 3:08 pm
Posts: 7
Hi all!

Does anybody know what the following GtkErrors mean and how they are triggered?
* Gtk-ERROR **: Unknown segment type:

* IA__gtk_text_layout_get_line_display: code should not be reached

* Gtk-CRITICAL **: IA__gtk_text_buffer_insert: assertion `GTK_IS_TEXT_BUFFER (buffer)' failed

I can mention what " IA__gtk_text_buffer_insert: assertion `GTK_IS_TEXT_BUFFER (buffer)' failed" means,
but I have no idea how it is triggered.
I couldn't find anything helpful with google.

The background:
I have a very small c++ application, where three peers are connected and as a first step I would like
to print out the messages, which are sent between the peers, on a GtkTextView.
For this, I did the following:

GtkWidget *main_window;
GtkWidget *table_layout;
GtkWidget *view;
GtkTextBuffer *buffer;
GtkTextIter iter;

main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
table_layout = gtk_table_new(9,5,TRUE);
gtk_container_add(GTK_CONTAINER(main_window), table_layout);

view = gtk_text_view_new();
buffer = gtk_text_view_get_buffer((GtkTextView*)view);

gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0);
gtk_table_attach_defaults((GtkTable*)table_layout, (GtkWidget*)view,0,4,1,7);


In addition, the function update takes the received messages of the peers and
updates the text view. It is called by the receiver thread of the peer. The peer
and network stuff is implemented in separated classes.

void update(char* msg){
   gtk_text_buffer_insert(buffer, &iter, msg, strlen(msg));
   gtk_text_buffer_insert(buffer, &iter, "\n", strlen("\n"));

It works for a few seconds and shows the first 3 - 6 messages, after that it crashes with one of
the above listed errors.

Does anybody have an idea how this errors are triggered?

Thanks a lot!

 Post subject: Re: Gtk Errors "unknown segment type" and ...
PostPosted: Wed Feb 15, 2012 12:05 pm 
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia

You should note that GTK+ is not thread-safe and gtk_* calls should only be made from the thread that runs main loop. From the nature of the failure I assume you have some threading-related issue.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 5 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group