From cf347c47af84a03c35e7cf9315132cf790346736 Mon Sep 17 00:00:00 2001 From: Itay Grudev Date: Mon, 30 Jan 2017 17:47:01 +0000 Subject: Refactored SingleApplicationPrivate destructor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deleted the separate cleanUp method as it’s not used from anywhere but the destructor. --- singleapplication.cpp | 30 +++++++++++++----------------- singleapplication_p.h | 1 - 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/singleapplication.cpp b/singleapplication.cpp index bb50f49..34d9b1d 100644 --- a/singleapplication.cpp +++ b/singleapplication.cpp @@ -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 */ diff --git a/singleapplication_p.h b/singleapplication_p.h index 661fe9e..266cbea 100644 --- a/singleapplication_p.h +++ b/singleapplication_p.h @@ -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(); -- cgit v1.2.1