Skip to content

Commit 4d20a39

Browse files
committed
Avoid recreating spatialite handles
1 parent 124f3df commit 4d20a39

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/providers/spatialite/qgsspatialiteconnection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ QgsSqliteHandle *QgsSqliteHandle::openDb( const QString &dbPath, bool shared )
731731

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

734-
QgsSqliteHandle *handle = new QgsSqliteHandle( database.release(), dbPath, shared );
734+
QgsSqliteHandle *handle = new QgsSqliteHandle( std::move( database ), dbPath, shared );
735735
if ( shared )
736736
sHandles.insert( dbPath, handle );
737737

src/providers/spatialite/qgsspatialiteconnection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ class QgsSqliteHandle
137137
// a class allowing to reuse the same sqlite handle for more layers
138138
//
139139
public:
140-
QgsSqliteHandle( sqlite3 *handle, const QString &dbPath, bool shared )
140+
QgsSqliteHandle( spatialite_database_unique_ptr &&database, const QString &dbPath, bool shared )
141141
: ref( shared ? 1 : -1 )
142142
, mDbPath( dbPath )
143143
, mIsValid( true )
144144
{
145-
mDatabase.reset( handle );
145+
mDatabase = std::move( database );
146146
}
147147

148148
sqlite3 *handle()

0 commit comments

Comments
 (0)