[PyQt] Old style signal/slot bug on win32

Giuseppe Corbelli giuseppe.corbelli at copanitalia.com
Mon May 27 09:30:52 BST 2013


On 24/05/2013 19:02, Phil Thompson wrote:
>> Hi all
>> I've found a strange bug on win32 using PyQt old style signals.
>> Sometimes I get a wrong result from QObject::receivers and the signal is
>
>> "lost". Looks like a PyQt bug cause a similar C++ example works
> correctly
>> both
>> on Linux and Win32.
>> Sidenotes:
>> * changing the signature for every new CRS instance seems to workaround
>> the bug
>> * not deleting (keeping a reference) every new CRS instance seems to
>> workaround the bug
>> * new style signals seem to work OK
>>
>> Tested on:
>> Python 2.7.3 (default, Mar  5 2013, 01:19:40) [GCC 4.7.2] on linux2
>> PYQT_VERSION_STR='snapshot-4.10.2-d9c6e01fe9ce'
>> QtCore.QT_VERSION_STR='4.8.2'
>> Linux 3.3.5 #1 SMP/32bit
>>
>> Python 2.7.3 (default, Dec 18 2012, 17:53:47) [MSC v.1500 32 bit
> (Intel)]
>> PYQT_VERSION_STR='4.9.6'
>> QT_VERSION_STR='4.8.4'
>> Windows 7/32bit and XP/32bit
>>
>> As programs output I expect matching emit/receive logs and 1 single
>> receiver.
>> Attached python and c++ examples.
>> Python program uses an "nexplode.txt" logfile in append mode, while C++
>> uses
>> qDebug()
>
> They work the same as far as I can tell - though it's difficult to see as
> the outputs are different.

Run the python one on win32 and linux, you should see different results, but 
see below.

> The programs themselves are too different to be a sensible comparison.

The flow is the same:
1) QTimer embedded in QCoreApplication
2) on timer expire create a new CRS
3) new CRS connects a slot in QCoreApplication to the sample_completed signal 
and emits it

In short I expect the ::receivers() to be ALWAYS 1.
grep 'receivers: "2"' nexplode.txt yields different results on win32 and 
linux. On linux I always get 'receivers: "1"' while on win32 sometimes i get 
'receivers: "2"'.

-- 
             Giuseppe Corbelli
WASP Software Engineer, Copan Italia S.p.A
Phone: +390303666318  Fax: +390302659932
E-mail: giuseppe.corbelli at copanitalia.com


More information about the PyQt mailing list