Dear list,

quick question: I spotted the class QSignalSpy while writing unit tests for
one of my projects. There was nothing written in the documentation, that it
is not thread safe and had assumed it is. So I connected signals from a
QObject running in a different thread and got several warnings (timers
cannot be killed, etc).
After inspecting its header file, I saw the usage of Qt::DirectConnection.

if (!QMetaObject::connect(obj, sigIndex, this, memberOffset,
Qt::DirectConnection, 0)).

I wonder now if this is intended or the two occurrences can be changed to
Qt::AutoConnection.

if (!QMetaObject::connect(obj, sigIndex, this, memberOffset,
Qt::AutoConnection, 0)).

That should make the class pretty thread safe, no?
There is even a suggestion report:
https://bugreports.qt-project.org/browse/QTBUG-40616.
If you guys are happy, I'll send the patch to gerrit. But before doing it,
I wanted to check with you, if there is anything I might have missed.

Cheers
Roland
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to