[PyQt] [BUG] PyQt5 default behaviour related to sip.setdestroyonexit()

Vladimir Rutsky rutsky.vladimir at gmail.com
Wed Dec 23 19:38:17 GMT 2015


Hi, Phil!

On Fri, Dec 18, 2015 at 7:08 PM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> Can you try tonight's SIP snapshot (or the current hg). You will need to rebuild PyQt5 with it.
>
> Thanks,
> Phil

Bug is still reproducible.

I checked out hg sip (revision 1431:138eb1eded99), nightly PyQt
(5.5.2-snapshot-60e96c2f91b5),
plus I built Qt 5.5.1 with debug symbols (5.5.1 branch), debug Python
3.4 on Ubuntu 14.04.

Here is stack trace:

$ QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1  gdb --args
/mnt/data/bob/qt/PyQt5_5.5.2-snapshot-60e96c2f91b5_env_dbg/bin/python
pyqt5_destroy_on_exit_test.py
GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from
/mnt/data/bob/qt/PyQt5_5.5.2-snapshot-60e96c2f91b5_env_dbg/bin/python...done.
(gdb) r
Starting program:
/mnt/data/bob/qt/PyQt5_5.5.2-snapshot-60e96c2f91b5_env_dbg/bin/python
pyqt5_destroy_on_exit_test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Qt: gdb: -nograb added to command-line options.
         Use the -dograb option to enforce grabbing.
Weak ref <weakref at 0x7fffeccdcad8; dead> is dead
[New Thread 0x7fffe9ec1700 (LWP 5268)]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5c282aa in qpycore_qobject_metaobject
(pySelf=0x7fffecb31298, base=0x7fffedc8f080
<sipTypeDef_QtWidgets_QMenu>) at
../qpy/QtCore/qpycore_qobject_helpers.cpp:52
52          if (pySelf && ((pyqtWrapperType *)Py_TYPE(pySelf))->metaobject)
(gdb) bt
#0  0x00007ffff5c282aa in qpycore_qobject_metaobject
(pySelf=0x7fffecb31298, base=0x7fffedc8f080
<sipTypeDef_QtWidgets_QMenu>) at
../qpy/QtCore/qpycore_qobject_helpers.cpp:52
#1  0x00007fffed779e54 in sipQMenu::metaObject (this=0xfd83d0) at
sipQtWidgetspart0.cpp:132468
#2  0x00007ffff56abcbe in QObject::~QObject (this=0x7ffff2324300
<(anonymous namespace)::Q_QGS_qAccessibleCache::innerFunction()::holder>,
__in_chrg=<optimized out>) at kernel/qobject.cpp:987
#3  0x00007ffff1d207f0 in QAccessibleCache::~QAccessibleCache
(this=0x7ffff2324300 <(anonymous
namespace)::Q_QGS_qAccessibleCache::innerFunction()::holder>,
__in_chrg=<optimized out>)
    at accessible/qaccessiblecache_p.h:60
#4  0x00007ffff1d1ed72 in (anonymous
namespace)::Q_QGS_qAccessibleCache::Holder::~Holder
(this=0x7ffff2324300 <(anonymous
namespace)::Q_QGS_qAccessibleCache::innerFunction()::holder>,
    __in_chrg=<optimized out>) at accessible/qaccessiblecache.cpp:46
#5  0x00007ffff6adb259 in __run_exit_handlers (status=0,
listp=0x7ffff6e5d6c8 <__exit_funcs>,
run_list_atexit=run_list_atexit at entry=true) at exit.c:82
#6  0x00007ffff6adb2a5 in __GI_exit (status=<optimized out>) at exit.c:104
#7  0x00007ffff6ac0ecc in __libc_start_main (main=0x41e4d6 <main>,
argc=2, argv=0x7fffffffdd68, init=<optimized out>, fini=<optimized
out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd58)
    at libc-start.c:321
#8  0x000000000041e409 in _start ()
(gdb)

With "sip.setdestroyonexit(True)" script exits normally.


Regards,

Vladimir Rutsky


>
> On 15 Dec 2015, at 1:48 pm, Vladimir Rutsky <rutsky.vladimir at gmail.com> wrote:
>> Here is stack trace on Ubuntu 14.04 (Qt without debug symbols):
>>
>> $ QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1 gdb --args python
>> pyqt5_destroy_on_exit_test.py
>> GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
>> Copyright (C) 2015 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
>> and "show warranty" for details.
>> This GDB was configured as "x86_64-linux-gnu".
>> Type "show configuration" for configuration details.
>> For bug reporting instructions, please see:
>> <http://www.gnu.org/software/gdb/bugs/>.
>> Find the GDB manual and other documentation resources online at:
>> <http://www.gnu.org/software/gdb/documentation/>.
>> For help, type "help".
>> Type "apropos word" to search for commands related to "word"...
>> Reading symbols from python...done.
>> (gdb) r
>> Starting program:
>> /home/bob/work/modernization/protoacs/env_dbg/bin/python
>> pyqt5_destroy_on_exit_test.py
>> [Thread debugging using libthread_db enabled]
>> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>> Weak ref <weakref at 0x7fffdf17c358; dead> is dead
>> [New Thread 0x7fffdf9b2700 (LWP 13728)]
>> [New Thread 0x7fffe03f6700 (LWP 13727)]
>> [New Thread 0x7fffea824700 (LWP 13726)]
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x00007ffff5c282b8 in qpycore_qobject_metaobject
>> (pySelf=0x7fffdf185898, base=0x7fffed84a080
>> <sipTypeDef_QtWidgets_QMenu>) at
>> ../qpy/QtCore/qpycore_qobject_helpers.cpp:52
>> warning: Source file is more recent than executable.
>> 52          if (pySelf && ((pyqtWrapperType *)Py_TYPE(pySelf))->metaobject)
>> (gdb) bt
>> #0  0x00007ffff5c282b8 in qpycore_qobject_metaobject
>> (pySelf=0x7fffdf185898, base=0x7fffed84a080
>> <sipTypeDef_QtWidgets_QMenu>) at
>> ../qpy/QtCore/qpycore_qobject_helpers.cpp:52
>> #1  0x00007fffed334e64 in sipQMenu::metaObject (this=0xeef160) at
>> sipQtWidgetspart0.cpp:132467
>> #2  0x00007ffff5564a63 in QObject::~QObject() () from
>> /home/bob/Qt/5.5/gcc_64/lib/libQt5Core.so.5
>> #3  0x00007ffff1698058 in ?? () from /home/bob/Qt/5.5/gcc_64/lib/libQt5Gui.so.5
>> #4  0x00007ffff6adb259 in __run_exit_handlers (status=0,
>> listp=0x7ffff6e5d6c8 <__exit_funcs>,
>> run_list_atexit=run_list_atexit at entry=true) at exit.c:82
>> #5  0x00007ffff6adb2a5 in __GI_exit (status=<optimized out>) at exit.c:104
>> #6  0x00007ffff6ac0ecc in __libc_start_main (main=0x41e4d6 <main>,
>> argc=2, argv=0x7fffffffdc58, init=<optimized out>, fini=<optimized
>> out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdc48)
>>    at libc-start.c:321
>> #7  0x000000000041e409 in _start ()
>> (gdb) list
>> 47      // This is the helper for all implementations of QObject::metaObject().
>> 48      const QMetaObject *qpycore_qobject_metaobject(sipSimpleWrapper *pySelf,
>> 49              sipTypeDef *base)
>> 50      {
>> 51          // Return the dynamic meta-object if there is one.
>> 52          if (pySelf && ((pyqtWrapperType *)Py_TYPE(pySelf))->metaobject)
>> 53              return ((pyqtWrapperType *)Py_TYPE(pySelf))->metaobject->mo;
>> 54
>> 55          // Fall back to the static Qt meta-object.
>> 56          return reinterpret_cast<const QMetaObject
>> *>(((pyqt5ClassTypeDef *)base)->static_metaobject);
>> (gdb)
>>
>> On Windows I have Qt with debug symbols:
>>
>>  QtCore_d.pyd!qpycore_qobject_metaobject(_sipSimpleWrapper *
>> pySelf=0x044b6928, _sipTypeDef * base=0x0435fdc8) Line 52 C++
>>  QtWidgets_d.pyd!sipQMenu::metaObject() Line 197613 C++
>>  Qt5Cored.dll!QObject::~QObject() Line 987 C++
>>  Qt5Guid.dll!QAccessibleCache::~QAccessibleCache() C++
>>  Qt5Guid.dll!QAccessibleCache::`vector deleting destructor'(unsigned int) C++
>>  Qt5Guid.dll!``anonymous
>> namespace'::Q_QGS_qAccessibleCache::innerFunction'::`8'::Cleanup::~Cleanup()
>> Line 46 C++
>>  Qt5Guid.dll!``anonymous
>> namespace'::Q_QGS_qAccessibleCache::innerFunction'::`9'::`dynamic
>> atexit destructor for 'cleanup''() C++
>>  Qt5Guid.dll!_CRT_INIT(void * hDllHandle=0x03370000, unsigned long
>> dwReason=0, void * lpreserved=0x00000001) Line 416 C
>>  Qt5Guid.dll!__DllMainCRTStartup(void * hDllHandle=0x03370000,
>> unsigned long dwReason=0, void * lpreserved=0x00000001) Line 522 C
>>  Qt5Guid.dll!_DllMainCRTStartup(void * hDllHandle=0x03370000,
>> unsigned long dwReason=0, void * lpreserved=0x00000001) Line 472 C
>>  ntdll.dll!_LdrpCallInitRoutine at 16 () Unknown
>>  ntdll.dll!_LdrShutdownProcess at 0 () Unknown
>>  ntdll.dll!_RtlExitUserProcess at 4 () Unknown
>>  kernel32.dll!_ExitProcessStub at 4 () Unknown
>>  msvcr110d.dll!__crtExitProcess(int status=0) Line 726 C
>>  msvcr110d.dll!doexit(int code=0, int quick=0, int retcaller=0) Line 639 C
>>  msvcr110d.dll!exit(int code=0) Line 395 C
>>  python_d.exe!__tmainCRTStartup() Line 549 C
>>  python_d.exe!wmainCRTStartup() Line 377 C
>>  kernel32.dll!@BaseThreadInitThunk at 12 () Unknown
>>  ntdll.dll!___RtlUserThreadStart at 8 () Unknown
>>  ntdll.dll!__RtlUserThreadStart at 8 () Unknown
>>
>>
>> Regards,
>>
>> Vladimir Rutsky
>>
>


More information about the PyQt mailing list