1
0
mirror of https://github.com/itay-grudev/SingleApplication.git synced 2025-03-31 17:42:39 +08:00

Bugfix no showUp notification. Some minor improvements

This commit is contained in:
Itay Grudev 2016-05-04 20:51:06 +01:00
parent 8bccf446e1
commit 6fe4403941

View File

@ -41,14 +41,14 @@ public:
#endif #endif
// 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
server = new QLocalServer();
QLocalServer::removeServer( memory->key() ); QLocalServer::removeServer( memory->key() );
server = new QLocalServer();
server->listen( memory->key() ); server->listen( memory->key() );
QObject::connect( QObject::connect(
server, server,
SIGNAL( newConnection() ), &QLocalServer::newConnection,
q, q,
SLOT( slotConnectionEstablished() ) &SingleApplication::slotConnectionEstablished
); );
// Reset the number of connections // Reset the number of connections
@ -73,6 +73,11 @@ public:
crashHandler(); crashHandler();
#endif #endif
notifyPrimary();
}
void notifyPrimary()
{
// Connect to the Local Server of the main process to notify it // Connect to the Local Server of the main process to notify it
// that a new process had been started // that a new process had been started
QLocalSocket socket; QLocalSocket socket;
@ -225,7 +230,8 @@ SingleApplication::SingleApplication(int &argc, char *argv[], uint8_t secondaryI
} }
} }
delete d->memory; d->notifyPrimary();
delete d;
::exit(EXIT_SUCCESS); ::exit(EXIT_SUCCESS);
} }