PDA

View Full Version : program crashes when more than 10 million signal emitted



cic
14th August 2013, 15:34
I have no idea what is the problem. The code is below:

ps: the way Qt::DirectConnection is no problem.



loop.connect(this, SIGNAL(postData(int)), this, SLOT(getData(int)), Qt::QueuedConnection);

for (int i = 0; i < TEN_MILLION; i++) {
emit postData(10);
}

loop.exec();



Here in the debugger I can see mostly the program crashed when i around 5 million.

karankumar1609
14th August 2013, 16:07
the same problem happn with me., but still don't know what exact the problem is. it might be the item internall call update() function.
if i call signals million times even ten million times without doing any GUI changes. just print the qDebug() it works fine.

Lesiok
14th August 2013, 18:58
Because the program must keep these few million. For qued connection emit saves information about this fact and the slot is activated only by the event loop. In the case of direct connection slot is activated immediately (like normal function) and do not need to be remembered. I do not think your test was a real situation.