mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2025-01-15 17:02:06 +08:00
Refactored SingleApplicationPrivate destructor.
Deleted the separate cleanUp method as it’s not used from anywhere but the destructor.
This commit is contained in:
parent
b0078af7d3
commit
cf347c47af
@ -47,7 +47,19 @@ SingleApplicationPrivate::SingleApplicationPrivate( SingleApplication *q_ptr ) :
|
|||||||
|
|
||||||
SingleApplicationPrivate::~SingleApplicationPrivate()
|
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 )
|
void SingleApplicationPrivate::genBlockServerName( int timeout )
|
||||||
@ -230,22 +242,6 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, char connectionType
|
|||||||
QMutex SingleApplicationPrivate::sharedMemMutex;
|
QMutex SingleApplicationPrivate::sharedMemMutex;
|
||||||
#endif
|
#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
|
* @brief Executed when a connection has been made to the LocalServer
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,6 @@ public:
|
|||||||
void startPrimary( bool resetMemory );
|
void startPrimary( bool resetMemory );
|
||||||
void startSecondary();
|
void startSecondary();
|
||||||
void connectToPrimary( int msecs, char connectionType );
|
void connectToPrimary( int msecs, char connectionType );
|
||||||
void cleanUp();
|
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
void crashHandler();
|
void crashHandler();
|
||||||
|
Loading…
Reference in New Issue
Block a user