Hello there!
We have a QApplication which launch a posix thread which communicates with a server. When some messages arrives is neccesary to display some qt windows. When we try to create the Qt windows from the posix thread the following error appears:
Xlib: unexpected async reply (sequence 0x79)!
(the value of the sequence may differs between executions).
The following conditions are required:
- The thread must not be a Qt thread.
- The windows must be created and destroyed (not show/hide).
Any suggestion would be appreciated.
Thank you!!
--
Source example. This is not a working example: just for understanding concept only. It will not compile.
file: main.cpp
--------------
#include <QCoreApplication>
#include <QWidget>
#include "buildIHMITestMgrSubscripter.h"
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QWidget>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
buildIHMITestMgrSubscripter *Manager; //Thread launching class.
Manager = new buildIHMITestMgrSubscripter();
return app.exec();
}
EOF ################################################## ##############
file: buildIHMITestMgrSubscripter.h
-----------------------------------
#include <time.h>
#include <iostream>
#include "thread.h"
#include "impl_controlsTest_1.h"
class buildIHMITestMgrSubscripter
{
public:
buildIHMITestMgrSubscripter();
static void* getBuildIHMITestNotify( void * pthis );
private:
impl_controlsTest_1* formControlTest1;
thread* oThread;
};
EOF ################################################## ##############
file buildIHMITestMgrSubscripter.cpp
------------------------------------
#include "buildIHMITestMgrSubscripter.h"
using namespace std;
buildIHMITestMgrSubscripter::buildIHMITestMgrSubsc ripter()
{
oThread = new thread( getBuildIHMITestNotify, 10, 0, 65536, (void*)this );
formControlTest1 = NULL;
}
void* buildIHMITestMgrSubscripter::getBuildIHMITestNotif y( void * pthis )
{
buildIHMITestMgrSubscripter *oBuildTestSub = ( buildIHMITestMgrSubscripter* )pthis;
formControlTest1 = new impl_controlsTest_1(); //This line crashes the application.
formControlTest1->setGeometry( QRect( 0,0,388,271 ) );
formControlTest1->show();
while( true )
{
//Here goes the code to listen server messages (not included)...
}
}
EOF ################################################## ##############
Bookmarks