mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 13:30: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);
|
||||
|
||||
if (args.isEmpty()) args.append("Empty");
|
||||
if (!args.isEmpty()) {
|
||||
// load into shared memory
|
||||
QBuffer buffer;
|
||||
buffer.open(QBuffer::ReadWrite);
|
||||
|
@ -168,15 +168,16 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
|||
localSocket.waitForDisconnected(1000);
|
||||
newArgs.detach();
|
||||
::exit(EXIT_SUCCESS); // Terminate the program using STDLib's exit function
|
||||
} else {
|
||||
}
|
||||
newArgs.detach();
|
||||
}
|
||||
// No main process exists
|
||||
// Or started without arguments
|
||||
// So we start a Local Server to listen for connections from new process
|
||||
localServer= new QLocalServer();
|
||||
QObject::connect(localServer, SIGNAL(newConnection()), this, SLOT(slotConnectionEstablished()));
|
||||
updateLocalServer();
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||
qInstallMessageHandler(qt_msg_handler);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue