mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 21:40:36 -04:00
Merge pull request #342 from PhenomRetroShare/Fix_AllowOnlyOneInst
Fix Allow Only One Instance
This commit is contained in:
commit
85c8274f47
1 changed files with 41 additions and 40 deletions
|
@ -128,7 +128,7 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
||||||
{
|
{
|
||||||
QString serverName = QString(TARGET);
|
QString serverName = QString(TARGET);
|
||||||
|
|
||||||
if (args.isEmpty()) args.append("Empty");
|
if (!args.isEmpty()) {
|
||||||
// load into shared memory
|
// load into shared memory
|
||||||
QBuffer buffer;
|
QBuffer buffer;
|
||||||
buffer.open(QBuffer::ReadWrite);
|
buffer.open(QBuffer::ReadWrite);
|
||||||
|
@ -168,15 +168,16 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
||||||
localSocket.waitForDisconnected(1000);
|
localSocket.waitForDisconnected(1000);
|
||||||
newArgs.detach();
|
newArgs.detach();
|
||||||
::exit(EXIT_SUCCESS); // Terminate the program using STDLib's exit function
|
::exit(EXIT_SUCCESS); // Terminate the program using STDLib's exit function
|
||||||
} else {
|
}
|
||||||
newArgs.detach();
|
newArgs.detach();
|
||||||
|
}
|
||||||
// No main process exists
|
// No main process exists
|
||||||
|
// Or started without arguments
|
||||||
// So we start a Local Server to listen for connections from new process
|
// So we start a Local Server to listen for connections from new process
|
||||||
localServer= new QLocalServer();
|
localServer= new QLocalServer();
|
||||||
QObject::connect(localServer, SIGNAL(newConnection()), this, SLOT(slotConnectionEstablished()));
|
QObject::connect(localServer, SIGNAL(newConnection()), this, SLOT(slotConnectionEstablished()));
|
||||||
updateLocalServer();
|
updateLocalServer();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||||
qInstallMessageHandler(qt_msg_handler);
|
qInstallMessageHandler(qt_msg_handler);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue