Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid recreating spatialite handles
  • Loading branch information
m-kuhn committed Nov 15, 2017
1 parent 124f3df commit 4d20a39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialiteconnection.cpp
Expand Up @@ -731,7 +731,7 @@ QgsSqliteHandle *QgsSqliteHandle::openDb( const QString &dbPath, bool shared )

QgsDebugMsg( "Connection to the database was successful" );

QgsSqliteHandle *handle = new QgsSqliteHandle( database.release(), dbPath, shared );
QgsSqliteHandle *handle = new QgsSqliteHandle( std::move( database ), dbPath, shared );
if ( shared )
sHandles.insert( dbPath, handle );

Expand Down
4 changes: 2 additions & 2 deletions src/providers/spatialite/qgsspatialiteconnection.h
Expand Up @@ -137,12 +137,12 @@ class QgsSqliteHandle
// a class allowing to reuse the same sqlite handle for more layers
//
public:
QgsSqliteHandle( sqlite3 *handle, const QString &dbPath, bool shared )
QgsSqliteHandle( spatialite_database_unique_ptr &&database, const QString &dbPath, bool shared )
: ref( shared ? 1 : -1 )
, mDbPath( dbPath )
, mIsValid( true )
{
mDatabase.reset( handle );
mDatabase = std::move( database );
}

sqlite3 *handle()
Expand Down

0 comments on commit 4d20a39

Please sign in to comment.