Fast changing QLineEdit crashing the application

2

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

visual-studio-2008
visual-c++
qt
asked on Stack Overflow Aug 25, 2010 by Roland Soós • edited Aug 26, 2010 by Roland Soós

1 Answer

1

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

answered on Stack Overflow Sep 2, 2010 by Tuminoid

User contributions licensed under CC BY-SA 3.0