PDA

View Full Version : qApp->processEvent() cause crash



songnailiang
16th April 2015, 08:24
There's one confused err in my code.
pseudo code as follows:

connect(mysignal, myslot);
connect(mtsignal_2, myslot);

void myslot(QString msg)
{
textEdit->append(msg);
qApp->processEvents(); //if comment this line, no crash, but other function also use this to prevent UI hang
}

void func()
{
for(i=0;i<n;i++)
emit mysignal;
}

[problem] when i increase to some fixed value, exe crash, err stack overflow in ntdll.dll

how to solve this bug?
Thanks in advance!

anda_skoa
16th April 2015, 11:00
Why would you even want to call that in there?

Cheers,
_

yeye_olive
16th April 2015, 14:10
Calling qApp->processEvents() only makes sense in the middle of a long-running computation ; it is useless just before control returns to the event loop, as is the case here.