From d388e9583f985ba1f09c26527605110e64066c45 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 21 Aug 2015 08:14:50 -0400 Subject: Another quick fix to the single-instance framework - add a manual existance check to teh lock file. --- libLumina/LuminaSingleApplication.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libLumina/LuminaSingleApplication.cpp') diff --git a/libLumina/LuminaSingleApplication.cpp b/libLumina/LuminaSingleApplication.cpp index 2b1994e1..2ecbc276 100644 --- a/libLumina/LuminaSingleApplication.cpp +++ b/libLumina/LuminaSingleApplication.cpp @@ -75,7 +75,7 @@ void LSingleApplication::PerformLockChecks(){ //qDebug() << " - Try Lock Again:" << primary; } } - if(primary){ + if(primary || !QFile::exists(cfile) ){ //Create the server socket //qDebug() << "Create Local Server"; if(QFile::exists(cfile)){ QLocalServer::removeServer(cfile); } //stale socket/server file @@ -95,12 +95,14 @@ void LSingleApplication::PerformLockChecks(){ }else{ //forward the current inputs to the locked process for processing and exit - qDebug() << "Single-instance lock found"; - qDebug() << " - Forwarding inputs to locking process and exiting..."; + //Check the connection to the local server first QLocalSocket socket(this); socket.connectToServer(cfile); socket.waitForConnected(); if(!socket.isValid()){ exit(1); } //error - could not forward info + + qDebug() << "Single-instance lock found"; + qDebug() << " - Forwarding inputs to locking process and exiting..."; socket.write( inputlist.join("::::").toLocal8Bit() ); socket.waitForDisconnected(500); //max out at 1/2 second (only hits this if no inputs) } -- cgit