Skip to content

Commit

Permalink
Replace QSharedPointer with std::shared_ptr in QgsHanaConnectionPool
Browse files Browse the repository at this point in the history
  • Loading branch information
mrylov committed Dec 7, 2020
1 parent 749f700 commit e171007
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/providers/hana/qgshanaconnectionpool.cpp
Expand Up @@ -26,15 +26,15 @@ QgsHanaConnectionPoolGroup::QgsHanaConnectionPoolGroup( const QString &name )
}

QBasicMutex QgsHanaConnectionPool::sMutex;
QSharedPointer<QgsHanaConnectionPool> QgsHanaConnectionPool::sInstance;
std::shared_ptr<QgsHanaConnectionPool> QgsHanaConnectionPool::sInstance;

QgsHanaConnection *QgsHanaConnectionPool::getConnection( const QString &connInfo )
{
QSharedPointer<QgsConnectionPool> instance;
std::shared_ptr<QgsConnectionPool> instance;
{
QMutexLocker lock( &sMutex );
if ( !sInstance )
sInstance = QSharedPointer<QgsHanaConnectionPool>( new QgsHanaConnectionPool() );
sInstance = std::shared_ptr<QgsHanaConnectionPool>( new QgsHanaConnectionPool() );
instance = sInstance;
}
return instance->acquireConnection( connInfo );
Expand All @@ -53,7 +53,7 @@ void QgsHanaConnectionPool::cleanupInstance()
{
QMutexLocker lock( &sMutex );
if ( sInstance )
sInstance.clear();
sInstance.reset();
}

QgsHanaConnectionPool::QgsHanaConnectionPool()
Expand Down
4 changes: 2 additions & 2 deletions src/providers/hana/qgshanaconnectionpool.h
Expand Up @@ -20,8 +20,8 @@
#include "qgshanaconnection.h"
#include "qgsconnectionpool.h"

#include <memory>
#include <QMutex>
#include <QSharedPointer>

inline QString qgsConnectionPool_ConnectionToName( QgsHanaConnection *c )
{
Expand Down Expand Up @@ -85,7 +85,7 @@ class QgsHanaConnectionPool

private:
static QBasicMutex sMutex;
static QSharedPointer<QgsHanaConnectionPool> sInstance;
static std::shared_ptr<QgsHanaConnectionPool> sInstance;
};

class QgsHanaConnectionRef
Expand Down

0 comments on commit e171007

Please sign in to comment.