GNOME Bugzilla – Bug 674475
Sorting ListStore result in crash
Last modified: 2012-04-23 16:48:48 UTC
Hi, this piece of code causes crash, but I do not know, if I am doing something wrong or it is just bug def compare(model, row1, row2, user_data): sort_column, dummy = model.get_sort_column_id() value1 = model.get_value(row1, sort_column) value2 = model.get_value(row2, sort_column) if value1 < value2: return 1 elif value1 == value2: return 0 else: return -1 model = Gtk.ListStore(str, str) model.set_sort_func(0, compare, None) model.set_sort_column_id(0, Gtk.SortType.DESCENDING) model.append(['20', 'Newton']) model.append(['20', 'Einstein']) model.append(['20', 'Tesla']) model.append(['25', 'Shuttleworth'])
This works fine for me with Python 2, but with Python 3 I indeed get a crash. Can you confirm that you run this with Python 3?
+ Trace 230122
Yes, python2 is fine, but python 3 crashes (I have used VBox instead of liststore, so it does not bug me that much).
Created attachment 212615 [details] [review] test case Test case patch for pygobject test suite. This crashes with Python 3.
This is another case of the SIGSEGV/SIGILL when C calls a Python callback with Python 3. *** This bug has been marked as a duplicate of bug 669157 ***
I committed the test case anyway, it can't hurt to have it.