After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674475 - Sorting ListStore result in crash
Sorting ListStore result in crash
Status: RESOLVED DUPLICATE of bug 669157
Product: pygobject
Classification: Bindings
Component: introspection
3.2.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-20 15:31 UTC by Pavol Klačanský
Modified: 2012-04-23 16:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (1.54 KB, patch)
2012-04-23 16:35 UTC, Martin Pitt
needs-work Details | Review

Description Pavol Klačanský 2012-04-20 15:31:13 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'])
Comment 1 Martin Pitt 2012-04-23 16:10:34 UTC
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?

  • #0 ??
  • #1 gtk_list_store_compare_func
    at /build/buildd/gtk+3.0-3.4.1/./gtk/gtkliststore.c line 1962
  • #2 g_sequence_sort_changed_iter
    at /build/buildd/glib2.0-2.32.1/./glib/gsequence.c line 945
  • #3 gtk_list_store_insert_with_valuesv
    at /build/buildd/gtk+3.0-3.4.1/./gtk/gtkliststore.c line 2325
  • #4 ffi_call_unix64
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #5 ffi_call
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #6 g_callable_info_invoke
    from /usr/lib/libgirepository-1.0.so.1
  • #7 g_function_info_invoke
    from /usr/lib/libgirepository-1.0.so.1
  • #8 ??
    from /usr/lib/python3/dist-packages/gi/_gi.cpython-32mu.so

Comment 2 Pavol Klačanský 2012-04-23 16:24:25 UTC
Yes, python2 is fine, but python 3 crashes (I have used VBox instead of liststore, so it does not bug me that much).
Comment 3 Martin Pitt 2012-04-23 16:35:29 UTC
Created attachment 212615 [details] [review]
test case

Test case patch for pygobject test suite. This crashes with Python 3.
Comment 4 Martin Pitt 2012-04-23 16:47:28 UTC
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 ***
Comment 5 Martin Pitt 2012-04-23 16:48:48 UTC
I committed the test case anyway, it can't hurt to have it.