Sat, 12 Jan 2008

weird gtksequence.c errors

Recently I was having a problem with a threaded pygtk app I was working on and nearly went insane trying to track down the problem. What was happening was I would randomly get errors that would cause the application to crash, such as:
Gtk-ERROR **: file gtksequence.c: line 760 (_gtk_sequence_node_find_by_pos): assertion failed: (node->parent != NULL)
aborting...

or

Gtk-ERROR **: file gtksequence.c: line 595 (_gtk_sequence_node_rotate): assertion failed: (node->parent)
aborting...
I couldn't really figure out what was going on since it was so random, it would happen 1 of 10 tries, then 3 of 10 and just all very random. I found the call that was causing it but still managed to not understand what the problem was. Anyways, after carefully going through my code and much google searching, I finally realized that my call was updating the gtk interface but I had forgot to make my call to enter the gtk thread before hand. So as a note to myself, always remember to make gtk.threads_enter/leave() calls! Ack.
gtk.threads_enter()
self.mainapp.function()
gtk.threads_leave()

posted at: 04:48 | path: /pygtk | permanent link to this entry


Powered by PyBlosxom | RSS 2.0