mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2025-04-19 11:44:43 +08:00
Removed extra qDebug statements
This commit is contained in:
parent
e4282f2476
commit
fb9c0bd2ef
@ -5,5 +5,7 @@ int main(int argc, char *argv[])
|
|||||||
// Allow secondary instances
|
// Allow secondary instances
|
||||||
SingleApplication app( argc, argv );
|
SingleApplication app( argc, argv );
|
||||||
|
|
||||||
|
qWarning() << "Started a new instance";
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,6 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
|
|||||||
abortSafely();
|
abortSafely();
|
||||||
}
|
}
|
||||||
d->initializeMemoryBlock();
|
d->initializeMemoryBlock();
|
||||||
qDebug() << "SingleApplication: Created and initialized new memory block.";
|
|
||||||
} else {
|
} else {
|
||||||
if( d->memory->error() == QSharedMemory::AlreadyExists ){
|
if( d->memory->error() == QSharedMemory::AlreadyExists ){
|
||||||
// Attempt to attach to the memory segment
|
// 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.";
|
qCritical() << "SingleApplication: Unable to lock memory block after attach.";
|
||||||
abortSafely();
|
abortSafely();
|
||||||
}
|
}
|
||||||
qDebug() << "SingleApplication: Attached to new memory block.";
|
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "SingleApplication: Unable create block.";
|
qCritical() << "SingleApplication: Unable create block.";
|
||||||
abortSafely();
|
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
|
// Make sure the shared memory block is initialised and in consistent state
|
||||||
while( true ){
|
while( true ){
|
||||||
qDebug() << "SingleApplication: Verifying block checksum.";
|
|
||||||
|
|
||||||
// If the shared memory block's checksum is valid continue
|
// If the shared memory block's checksum is valid continue
|
||||||
if( d->blockChecksum() == inst->checksum ) break;
|
if( d->blockChecksum() == inst->checksum ) break;
|
||||||
|
|
||||||
qDebug() << "SingleApplication: Invalid block checksum. Waiting.";
|
|
||||||
|
|
||||||
// If more than 5s have elapsed, assume the primary instance crashed and
|
// If more than 5s have elapsed, assume the primary instance crashed and
|
||||||
// assume it's position
|
// assume it's position
|
||||||
if( time.elapsed() > 5000 ){
|
if( time.elapsed() > 5000 ){
|
||||||
|
@ -169,9 +169,6 @@ void SingleApplicationPrivate::startPrimary()
|
|||||||
qstrncpy( inst->primaryUser, getUsername().toUtf8().data(), sizeof(inst->primaryUser) );
|
qstrncpy( inst->primaryUser, getUsername().toUtf8().data(), sizeof(inst->primaryUser) );
|
||||||
inst->checksum = blockChecksum();
|
inst->checksum = blockChecksum();
|
||||||
instanceNumber = 0;
|
instanceNumber = 0;
|
||||||
|
|
||||||
qDebug() << "SingleApplication: Started as a primary instance.";
|
|
||||||
|
|
||||||
// Successful creation means that no main process exists
|
// Successful creation means that no main process exists
|
||||||
// So we start a QLocalServer to listen for connections
|
// So we start a QLocalServer to listen for connections
|
||||||
QLocalServer::removeServer( blockServerName );
|
QLocalServer::removeServer( blockServerName );
|
||||||
@ -201,8 +198,6 @@ void SingleApplicationPrivate::startSecondary()
|
|||||||
inst->secondary += 1;
|
inst->secondary += 1;
|
||||||
inst->checksum = blockChecksum();
|
inst->checksum = blockChecksum();
|
||||||
instanceNumber = inst->secondary;
|
instanceNumber = inst->secondary;
|
||||||
|
|
||||||
qDebug() << "SingleApplication: Started as a secondary instance.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType connectionType )
|
void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType connectionType )
|
||||||
|
Loading…
Reference in New Issue
Block a user