[PyQt] Signal/slot bug when doing multiple connects and Qt::UniqueConnection

Giuseppe Corbelli giuseppe.corbelli at copanitalia.com
Wed Apr 30 09:42:45 BST 2014


On 29/04/2014 16:05, Phil Thompson wrote:
> On 28/04/2014 10:39 am, Giuseppe Corbelli wrote:
>> On 28/04/2014 09:26, Giuseppe Corbelli wrote:
>>> Hi all
>>> I've run into an "interesting" side effect, admittedly misusing the
>>> signal-slot mechanism. Basically I'm doing multiple connections using the
>>> Qt::UniqueConnection parameter. As expected the slot is run always a single
>>> time, but there's something weird going on in the background. The receivers()
>>> method returns increasing numbers and this little example will kill the CPU in
>>> a few iteractions.
>
> Fixed in tonight's PyQt4 and PyQt5 snapshots - I just hadn't bothered to add
> support for UniqueConnection.

Issue solved. One question, though: I see you're checking for

#if QT_VERSION >= 0x040600
     if (type == Qt::UniqueConnection)

This would break again if I use any other type ORed, say 
BlockingQueuedConnection|UniqueConnection.

Why not:

#if QT_VERSION >= 0x040600
     if ((type & Qt::UniqueConnection) == Qt::UniqueConnection)

?

-- 
             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