aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItay Grudev <itay+git2020@grudev.com>2020-09-09 00:41:05 +0100
committerItay Grudev <itay+git2020@grudev.com>2020-09-09 00:48:55 +0100
commitfb9c0bd2ef0dff76f4a2488395fe011aca888e52 (patch)
tree22f9fec606fff8d62f62ccb7503c671cc7b378cd
parentMitigated possible race condition during app startup (diff)
downloadsingleapplication-fb9c0bd2ef0dff76f4a2488395fe011aca888e52.tar.xz
Removed extra qDebug statements
-rwxr-xr-xexamples/basic/main.cpp2
-rw-r--r--singleapplication.cpp6
-rw-r--r--singleapplication_p.cpp5
3 files changed, 2 insertions, 11 deletions
diff --git a/examples/basic/main.cpp b/examples/basic/main.cpp
index 1841902..c22af03 100755
--- a/examples/basic/main.cpp
+++ b/examples/basic/main.cpp
@@ -5,5 +5,7 @@ int main(int argc, char *argv[])
// Allow secondary instances
SingleApplication app( argc, argv );
+ qWarning() << "Started a new instance";
+
return app.exec();
}
diff --git a/singleapplication.cpp b/singleapplication.cpp
index 4fae535..27c0316 100644
--- a/singleapplication.cpp
+++ b/singleapplication.cpp
@@ -79,7 +79,6 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
abortSafely();
}
d->initializeMemoryBlock();
- qDebug() << "SingleApplication: Created and initialized new memory block.";
} else {
if( d->memory->error() == QSharedMemory::AlreadyExists ){
// Attempt to attach to the memory segment
@@ -91,7 +90,6 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
qCritical() << "SingleApplication: Unable to lock memory block after attach.";
abortSafely();
}
- qDebug() << "SingleApplication: Attached to new memory block.";
} else {
qCritical() << "SingleApplication: Unable create block.";
abortSafely();
@@ -104,13 +102,9 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
// Make sure the shared memory block is initialised and in consistent state
while( true ){
- qDebug() << "SingleApplication: Verifying block checksum.";
-
// If the shared memory block's checksum is valid continue
if( d->blockChecksum() == inst->checksum ) break;
- qDebug() << "SingleApplication: Invalid block checksum. Waiting.";
-
// If more than 5s have elapsed, assume the primary instance crashed and
// assume it's position
if( time.elapsed() > 5000 ){
diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp
index a5f5823..a826e8a 100644
--- a/singleapplication_p.cpp
+++ b/singleapplication_p.cpp
@@ -169,9 +169,6 @@ void SingleApplicationPrivate::startPrimary()
qstrncpy( inst->primaryUser, getUsername().toUtf8().data(), sizeof(inst->primaryUser) );
inst->checksum = blockChecksum();
instanceNumber = 0;
-
- qDebug() << "SingleApplication: Started as a primary instance.";
-
// Successful creation means that no main process exists
// So we start a QLocalServer to listen for connections
QLocalServer::removeServer( blockServerName );
@@ -201,8 +198,6 @@ void SingleApplicationPrivate::startSecondary()
inst->secondary += 1;
inst->checksum = blockChecksum();
instanceNumber = inst->secondary;
-
- qDebug() << "SingleApplication: Started as a secondary instance.";
}
void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType connectionType )