Skip to content

Commit 716ed6b

Browse files
committed
Prevent memory leaks
1 parent 447cd18 commit 716ed6b

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

src/core/symbology/qgsstyle.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ bool QgsStyle::openDatabase( const QString &filename )
281281
if ( rc )
282282
{
283283
mErrorString = QStringLiteral( "Couldn't open the style database: %1" ).arg( mCurrentDB.errorMessage() );
284-
mCurrentDB.release();
285284
return false;
286285
}
287286

@@ -614,7 +613,6 @@ int QgsStyle::addTag( const QString &tagname )
614613
statement = mCurrentDB.prepare( query, nErr );
615614
if ( nErr == SQLITE_OK )
616615
( void )sqlite3_step( statement.get() );
617-
statement.release();
618616

619617
QgsSettings settings;
620618
settings.setValue( QStringLiteral( "qgis/symbolsListGroupsIndex" ), 0 );
@@ -641,8 +639,6 @@ QStringList QgsStyle::tags() const
641639
tagList << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( statement.get(), 0 ) ) );
642640
}
643641

644-
statement.release();
645-
646642
return tagList;
647643
}
648644

@@ -820,9 +816,6 @@ QStringList QgsStyle::findSymbols( StyleEntity type, const QString &qword )
820816
tagids << QString::fromUtf8( ( const char * ) sqlite3_column_text( statement.get(), 0 ) );
821817
}
822818

823-
statement.release();
824-
825-
826819
QString dummy = tagids.join( QStringLiteral( ", " ) );
827820

828821
if ( type == SymbolEntity )
@@ -892,8 +885,6 @@ bool QgsStyle::tagSymbol( StyleEntity type, const QString &symbol, const QString
892885
tagid = addTag( tag );
893886
}
894887

895-
statement.release();
896-
897888
// Now map the tag to the symbol if it's not already tagged
898889
if ( !symbolHasTag( type, symbol, tag ) )
899890
{
@@ -938,8 +929,6 @@ bool QgsStyle::detagSymbol( StyleEntity type, const QString &symbol, const QStri
938929
return false;
939930
}
940931

941-
statement.release();
942-
943932
Q_FOREACH ( const QString &tag, tags )
944933
{
945934
query = sqlite3_mprintf( "SELECT id FROM tag WHERE name='%q'", tag.toUtf8().constData() );
@@ -1040,8 +1029,6 @@ QStringList QgsStyle::tagsOfSymbol( StyleEntity type, const QString &symbol )
10401029
}
10411030
}
10421031

1043-
statement.release();
1044-
10451032
return tagList;
10461033
}
10471034

@@ -1092,8 +1079,6 @@ QString QgsStyle::tag( int id ) const
10921079
tag = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( statement.get(), 0 ) ) );
10931080
}
10941081

1095-
statement.release();
1096-
10971082
return tag;
10981083
}
10991084

@@ -1110,8 +1095,6 @@ int QgsStyle::getId( const QString &table, const QString &name )
11101095
id = sqlite3_column_int( statement.get(), 0 );
11111096
}
11121097

1113-
statement.release();
1114-
11151098
return id;
11161099
}
11171100

@@ -1128,8 +1111,6 @@ QString QgsStyle::getName( const QString &table, int id ) const
11281111
name = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( statement.get(), 0 ) ) );
11291112
}
11301113

1131-
statement.release();
1132-
11331114
return name;
11341115
}
11351116

@@ -1219,8 +1200,6 @@ QgsSymbolGroupMap QgsStyle::smartgroupsListMap()
12191200
groupNames.insert( sqlite3_column_int( statement.get(), SmartgroupId ), group );
12201201
}
12211202

1222-
statement.release();
1223-
12241203
return groupNames;
12251204
}
12261205

@@ -1245,8 +1224,6 @@ QStringList QgsStyle::smartgroupNames()
12451224
groups << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( statement.get(), 0 ) ) );
12461225
}
12471226

1248-
statement.release();
1249-
12501227
return groups;
12511228
}
12521229

@@ -1260,7 +1237,6 @@ QStringList QgsStyle::symbolsOfSmartgroup( StyleEntity type, int id )
12601237
int nErr; statement = mCurrentDB.prepare( query, nErr );
12611238
if ( !( nErr == SQLITE_OK && sqlite3_step( statement.get() ) == SQLITE_ROW ) )
12621239
{
1263-
statement.release();
12641240
return QStringList();
12651241
}
12661242
else
@@ -1384,8 +1360,6 @@ QgsSmartConditionMap QgsStyle::smartgroup( int id )
13841360
}
13851361
}
13861362

1387-
statement.release();
1388-
13891363
return condition;
13901364
}
13911365

@@ -1416,8 +1390,6 @@ QString QgsStyle::smartgroupOperator( int id )
14161390
op = smartEl.attribute( QStringLiteral( "operator" ) );
14171391
}
14181392

1419-
statement.release();
1420-
14211393
return op;
14221394
}
14231395

0 commit comments

Comments
 (0)