PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 1075 - Python destructors cause crash on exit due to destructors
: Python destructors cause crash on exit due to destructors
Status: ASSIGNED
Product: PySide
Classification: Unclassified
Component: Shiboken
: 1.0.6
: PC Linux
: P2 normal
Assigned To: Paulo Alcantara
:
:
:
  Show dependency treegraph
 
Reported: 2011-12-01 03:43 EET by James Westby
Modified: 2012-03-08 16:57 EET (History)
9 users (show)

See Also:


Attachments
Python file that reproduces the bug (1.48 KB, text/x-python)
2011-12-01 03:43 EET, James Westby
Details
QML file to go with the reproduction script (383 bytes, application/octet-stream)
2011-12-01 03:44 EET, James Westby
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Westby 2011-12-01 03:43:55 EET
Created attachment 460 [details]
Python file that reproduces the bug

Hi,

I think I've isolated a bug to do with the desctructor code.

When I close my application, it always segfaults. I've narrowed this
down to the fact that I have a ListModel that contains some items that
reference Python objects that have a destructor (__del__ method). Deleting
the destructors stops the crash.

This signature I get is

#0  PyErr_Fetch (p_type=0x7fffffffdeb8, p_value=0x7fffffffdec0,
p_traceback=0x7fffffffdec8) at ../Python/errors.c:249
#1  0x000000000047d7d4 in slot_tp_del (self=<ThingWithDestructor at remote
0xfe4a50>) at ../Objects/typeobject.c:5720
#2  0x000000000047db1e in subtype_dealloc (self=<ThingWithDestructor at remote
0xfe4a50>) at ../Objects/typeobject.c:966
#3  0x000000000045e7f9 in dict_dealloc (mp=0x125e0f0) at
../Objects/dictobject.c:985
#4  0x00007ffff5405551 in ?? () from
/usr/lib/x86_64-linux-gnu/libshiboken-python2.7.so.1.0
#5  0x00007ffff54055aa in SbkDeallocWrapper () from
/usr/lib/x86_64-linux-gnu/libshiboken-python2.7.so.1.0
#6  0x000000000047dc6b in subtype_dealloc (self=
    <Message(messageChanged=<PySide.QtCore.SignalInstance at remote
0x7ffff7f511f8>, _msg=u'AAAA', _thing=<ThingWithDestructor at remote 0xfe4a50>)
at remote 0xfea2d8>) at ../Objects/typeobject.c:1014
#7  0x00007ffff5405460 in Shiboken::Object::destroy(SbkObject*, void*) () from
/usr/lib/x86_64-linux-gnu/libshiboken-python2.7.so.1.0
#8  0x00007ffff540972a in Shiboken::BindingManager::~BindingManager() () from
/usr/lib/x86_64-linux-gnu/libshiboken-python2.7.so.1.0
#9  0x00007ffff69b8821 in __run_exit_handlers (status=0, listp=0x7ffff6d155a8,
run_list_atexit=true) at exit.c:78
#10 0x00007ffff69b88a5 in __GI_exit (status=<optimized out>) at exit.c:100
#11 0x00007ffff699e314 in __libc_start_main (main=0x41aa40 <main>, argc=2,
ubp_av=0x7fffffffe188, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffe178) at libc-start.c:258

and the reason for the SIGSEGV is that _PyThreadState_Current is NULL.

I'll attach a couple of files that reproduce this crash.

I believe the value is NULL because the code isn't being run in any
Python thread context. I don't know what the fix for that would be.

Thanks,

James
Comment 1 James Westby 2011-12-01 03:44:23 EET
Created attachment 461 [details]
QML file to go with the reproduction script
Comment 2 Matti Airas 2012-03-08 16:57:55 EET
PySide is now a Qt-addon and uses Qt Project's JIRA tool for tracking bugs.
Please verify that the bug is still valid and re-submit it in the address
below:

https://bugreports.qt-project.org/

Sorry for the inconvenience!