Refactored SingleApplicationPrivate destructor.

Deleted the separate cleanUp method as it’s not used from anywhere but
the destructor.
This commit is contained in:
Itay Grudev 2017-01-30 17:47:01 +00:00
parent b0078af7d3
commit cf347c47af
2 changed files with 13 additions and 18 deletions

View File

@ -47,7 +47,19 @@ SingleApplicationPrivate::SingleApplicationPrivate( SingleApplication *q_ptr ) :
SingleApplicationPrivate::~SingleApplicationPrivate()
{
cleanUp();
if( socket != nullptr ) {
socket->close();
delete socket;
}
memory->lock();
InstancesInfo* inst = (InstancesInfo*)memory->data();
if( server != nullptr ) {
server->close();
delete server;
inst->primary = false;
}
memory->unlock();
delete memory;
}
void SingleApplicationPrivate::genBlockServerName( int timeout )
@ -230,22 +242,6 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, char connectionType
QMutex SingleApplicationPrivate::sharedMemMutex;
#endif
void SingleApplicationPrivate::cleanUp() {
if( socket != nullptr ) {
socket->close();
delete socket;
}
memory->lock();
InstancesInfo* inst = (InstancesInfo*)memory->data();
if( server != nullptr ) {
server->close();
delete server;
inst->primary = false;
}
memory->unlock();
delete memory;
}
/**
* @brief Executed when a connection has been made to the LocalServer
*/

View File

@ -55,7 +55,6 @@ public:
void startPrimary( bool resetMemory );
void startSecondary();
void connectToPrimary( int msecs, char connectionType );
void cleanUp();
#ifdef Q_OS_UNIX
void crashHandler();