Fix FTBS on OS2, thank Elbert for tests

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3581 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2014-12-31 12:04:54 +00:00
parent 991a9bfbc9
commit 6e7e895bae
2 changed files with 9 additions and 1 deletions

View File

@@ -31,6 +31,10 @@ QETSingleApplication::QETSingleApplication(int &argc, char **argv, const QString
unique_key_(unique_key)
{
// verifie s'il y a un segment de memoire partage correspondant a la cle unique
#if defined (Q_OS_OS2)
#define QT_NO_SHAREDMEMORY
{
#else
shared_memory_.setKey(unique_key_);
if (shared_memory_.attach()) {
// oui : l'application est deja en cours d'execution
@@ -44,7 +48,7 @@ QETSingleApplication::QETSingleApplication(int &argc, char **argv, const QString
qDebug() << "QETSingleApplication::QETSingleApplication() : Impossible de cr\351er l'instance unique" << qPrintable(unique_key_);
return;
}
#endif
// initialisation d'un serveur local pour recevoir les messages des autres instances
local_server_ = new QLocalServer(this);
connect(local_server_, SIGNAL(newConnection()), this, SLOT(receiveMessage()));

View File

@@ -49,7 +49,11 @@ class QETSingleApplication : public QApplication {
private:
bool is_running_;
QString unique_key_;
#if defined (Q_OS_OS2)
#define QT_NO_SHAREDMEMORY
#else
QSharedMemory shared_memory_;
#endif
QLocalServer *local_server_;
static const int timeout_;
};