GNOME Bugzilla – Bug 159255
Using editable cell renderers and running threads crashes
Last modified: 2005-10-29 13:20:45 UTC
The attached example code does the following. From a certain interval of time it does a gst operation in the background using gst.Thread. When this operations is concluded it sends an idle callback to the mainloop which adds elements to a TreeView. However editing the cell values (using editable cell renderers) while the elements are added crashes the application. This only happens when the idle call is sent from the gst.Thread callback. To reproduce it just double click a row to edit it and a segmentation fault or a an sigterm is sent. Python sometimes shows this message before crashing: Fatal Python error: GC object already tracked
Created attachment 34079 [details] Piece of code that reproduces the problem.
Backtrace (gdb) bt
+ Trace 52576
sorry. forgot the backtrace for the second thread (or 8th, since it took a few iterations before it crashed) (gdb) bt
+ Trace 52577
Moving to PyGTK
Duplicate of #160349.
It's pretty clear that the ensure_gil_state call is failing to set a thread state. Can you see if the problem is that pyg_find_thread_state() is returning NULL on the main thread?
Running this program, I got: gjc@emperor:tmp$ python test.py /garbage/music/Summoning/Minas\ Morgul/02\ -\ Lugburz.mp3 ... eos ... Fatal Python error: Objects/frameobject.c:403 object at 0x80b879c has negative ref count -1 Aborted (core dumped) Then I added "gobject.threads_init()" right after importing modules, and then it works. Lesson to be taken: for programs that use threads, _any threads_, gobject.threads_init() _must_ be called.