views:

66

answers:

1

I have three QLineEdit fields, whose content is changing really fast (100/second). Somehow it crashes the application. Maybe it's a bug or I make a mistake.

Here is some code:

acc[0]->setText(QString("%1").arg(acceleration.x));
acc[1]->setText(QString("%1").arg(acceleration.y));
acc[2]->setText(QString("%1").arg(acceleration.z));

The call stack: http://pastebin.com/RmkZHTjk

And sometimes I get this error:

Unhandled exception at 0x6518cbb3 (QtGuid4.dll) in Test.exe: 0xC0000005: Access violation reading location 0x0000002c.

Call stack for this: http://pastebin.com/c1u53a0Z

I tried it with QLabel, then I get another error:

Unhandled exception at 0x751a9617 in Test.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x03aeea70..

Call stack: http://pastebin.com/G4yeiW2Y

A: 

Lets get this closed. This is Frank's answer posted as comment a week ago.

@Roland Soós: It looks to me like you call setText() from the non-UI thread. That won't work, QWidgets are not thread-safe. -- Frank

Tuminoid