GNOME Bugzilla – Bug 138685
segfault when "fixed-height-mode" property in treeview is set on.
Last modified: 2004-12-22 21:47:04 UTC
''' When the app is started, there are a treeview and two buttons. Button 'modify model' simply modify the text in tree's rows. If you click, it works. After 'fixed-height-mode' is set by clicking on the second button, clicking on button 'modify model' will now generate a segmentation fault ''' import gtk class MyTree(gtk.TreeView): def __init__(self,*args): super(MyTree,self).__init__(*args) renderer=gtk.CellRendererText() col=gtk.TreeViewColumn('readme',renderer) col.add_attribute(renderer, 'text', 1) col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) self.append_column(col) self.model = gtk.TreeStore(gobject.TYPE_PYOBJECT,str) self.set_model(self.model) self.text='second text' self.refreshModel() def refreshModel(self): print 'inside refreshModel' self.model.clear() if self.text=='first text': self.text='second text' else: self.text='first text' for i in range(4): iter=self.model.insert_before(None,None) self.model.set_value(iter,1,self.text) print 'exiting refreshModel' def main(): window = gtk.Window() window.connect('destroy', lambda win: gtk.main_quit()) window.set_size_request(300,200) vbox=gtk.VBox() tree=MyTree() vbox.pack_start(tree,1,1,0) hbox=gtk.HBox() btn1=gtk.Button('modify model') btn1.connect('clicked',lambda *x:tree.refreshModel()) btn2=gtk.Button('set fixed-height-mode on') btn2.connect('clicked',lambda *x: tree.set_property('fixed-height-mode',1)) hbox.pack_start(btn1,1,1,0) hbox.pack_start(btn2,1,1,0) vbox.pack_start(hbox,0,1,0) window.add(vbox) window.show_all() gtk.main() if __name__ == '__main__': main()
I can not reproduce on my machine. Can you attach a backtrace from gdb?
This is from pygtk 2.2.0. (gdb) run bug.py Starting program: /usr/bin/python bug.py (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)...inside refreshModel exiting refreshModel inside refreshModel Program received signal SIGSEGV, Segmentation fault. 0x407ded1b in _gtk_rbtree_node_set_height () from /usr/lib/libgtk-x11-2.0.so.0 (gdb) backtrace
+ Trace 45574
this is from pygtk-2.3.90 (gdb) run bug.py Starting program: /usr/bin/python bug.py (no debugging symbols found)...(no debugging symbols found)...[Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 28020)] (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)...inside refreshModel exiting refreshModel inside refreshModel Program received signal SIGSEGV, Segmentation fault.
+ Trace 45578
Thread 16384 (LWP 28020)
I can reproduce this, necessary elements: view.set_property('fixed-height-mode',1) model.clear() model.append(None) attached minimal crash inducing python code, crash.py complete stack trace:
+ Trace 45593
Created attachment 26212 [details] crash.py
I think this is a gtk+ bug.
Created attachment 26213 [details] minimal_crash.py reduce the crash inducing code further
Created attachment 26214 [details] crash.c The equavelent C code also segfaults. This is either a bug in gtk or a usage that should be catched in pygtk. I'll search the gtk bugzilla for this ..
This is bug #138082 on GtkTreeView in gtk. There is an attached patch that at least prevents the segfault there.
Product -> gtk+
*** This bug has been marked as a duplicate of 138082 ***