This commit fixes intermittent freezes of 'subscriber' dialog. These
freezes were caused by invoking QWidget::update() directly from a non-GUI
thread. This is undefined behavior and leads to many strange lock-ups and
even SEGFAULTS.
In order to fix this we now introduce the signal changed(), that will be
emitted if repaint of shapes is requested either from publisher or
subscriber. This signal is connected to the update() slot. By default
signals are connected to slots by Qt::AutoConnection connection type. This
should ensure, that QT decides internally if it should treat this
connection as Qt::DirectConnection in case of publisher and
Qt::QueuedConnection in case of subscriber. This decision is made when the
signal is emitted.
{
mousePressed=0;
objects[0]=objects[1]=objects[2]=objects[3]=objects[4]=0;
{
mousePressed=0;
objects[0]=objects[1]=objects[2]=objects[3]=objects[4]=0;
+
+ connect(this,SIGNAL(changed()),this,SLOT(update()));
void MyQFrame::deactivateObject(int object) {
if (object>4) return;
objects[object]=0;
void MyQFrame::deactivateObject(int object) {
if (object>4) return;
objects[object]=0;
}
void MyQFrame::setPosition(int object,QRect position) {
positions[object]=position;
}
void MyQFrame::setPosition(int object,QRect position) {
positions[object]=position;
}
void MyQFrame::paintEvent(QPaintEvent*)
}
void MyQFrame::paintEvent(QPaintEvent*)
int mousePressed;
int mouseX;
int mouseY;
int mousePressed;
int mouseX;
int mouseY;
+
+signals:
+ void changed(void);