Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
None
Description
If code, due user copy/paste error, ends up connecting a signal to itself rather than to the source signal that is actually emitted, then it is hard to find out what went wrong. I.e.
connect(this, SIGNAL(mySignal()), this, SIGNAL(mySignal()));
instead of
connect(sender, SIGNAL(mySignal()), this, SIGNAL(mySignal()));
where only sender emits the signal.
Since the incorrect connect is always invalid (it crashes with stack overflow if "this" emits the signal), Qt should warn about such a connecting.
Comment: Qt shouldn't check this at run time - spending CPU cycles in a performance critical part of Qt to check for a condition that never happens in valid code is not a good idea. We should make moc check for this at compile time instead.