PDA

View Full Version : QWaitCondition and slot problem



satoshi
8th May 2009, 11:09
Hi,
I've a slot:

void G2_ImageViewer::readImage()
{
this->mutex.lock();
if(this->getRingBuffer()->isReadLocked())
{
this->readLocked.wait(&this->mutex);
}
this->mutex.unlock();

this->getRingBuffer()->pop();
}

When the ringbuffer is read locked (this->getRingBuffer()->isReadLocked() == true), it waits that someone unlock it. The problem is that this slot is connected to the signal clicked() of a QPushButton and if the slot is locked and it receives another signal, the program crashes.

How can I do to avoid the problem?

Thank you! Dario

(sorry for my english)