[Qt-interest] Problem drawning in the GUI Thread with Data from another Thread

Srdjan Todorovic todorovic.s at googlemail.com
Fri Jul 3 01:47:59 CEST 2009


Hi,

2009/7/3 O Caldas <caldaz.sheep at gmail.com>:
> oh, and here is the code of the paintEvent() method:
>
> void PopGraph::paintEvent(QPaintEvent*){
>     QPainter painter2(this);
>     painter2.drawImage(QPoint(0,0), *buffer);
> }

How do you call PopGraph::graphUpdate() ?

If the thread's signal is firing fast enough, could there be a race
condiditon between paintEvent()'s drawImage() using buffer, and
deleting buffer in graphUpdate() ?

Does the application crash? And if so, do you know which line of code crashes?

> buffer is an atribute QImage* of the class

>> void PopGraph::graphUpdate(){
>>     delete(buffer);
>>     buffer = new QImage(size(), QImage::Format_ARGB32);

>>     }
>> //    if(contador == 1){
>> //        contador =0;
>>         update();
>> }

Srdjan




More information about the Qt-interest-old mailing list