Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.3.2
-
None
-
Windows 7
Description
Consider the following code:
mainwindow.h
public slots: void testSlotA(); signals: void testSignal(int x); private: int m_x = 0;
void MainWindow::testSlotA()
{
m_x++;
qDebug() << "?? PING" << m_x;
connect(this, &MainWindow::testSignal, this, [=](int x)
, Qt::UniqueConnection);
emit testSignal(m_x);
}
Now if I call testSlotA 3 times it produces the following output:
?? PING 1 !! PONG 1 ?? PING 2 !! PONG 2 !! PONG 2 ?? PING 3 !! PONG 3 !! PONG 3 !! PONG 3
This is wrong, using Qt::UniqueConnection the output should be:
?? PING 1 !! PONG 1 ?? PING 2 !! PONG 2 ?? PING 3 !! PONG 3
Attachments
For Gerrit Dashboard: QTBUG-52438 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
180385,4 | Doc: add a note that UniqueConnection does not work for lambdas | 5.8 | qt/qtbase | Status: MERGED | +2 | 0 |