PDA

View Full Version : setPixmap crash (in a thread)



truegladiator
21st February 2011, 15:04
Hi,

My QT application uses QLabel->setPixmap() while setting the pixmaps at runtime.

The pixmap is created on Heap (pixmap = new QPixmap(w,h)), & I use this pixmap to paint multiple QLabels at runtime (this pixmap is just a temporary pixmap to maintain my view).

For example: when I move the scroller in a window containing my labels I am setting pixmaps or filling all my labels with this pixmap. The initial load of application is fine and it fill all the labels with same pixmap successfully (this code is in main application thread).

But it just works well for few scroll moves [my thread with
code qLabel->setPixmap(*pixmap) is already started here ]..till the time it throws the memory exception.

Any ideas?

Using:-
Qt : 4.6.3
Windows : 7

mcosta
21st February 2011, 16:01
As general rule:
You CANNOT interact with GUI elements from other thread than Main.

Please Post some piece of code.