mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-02 00:02:12 -05:00
Add comment on detach use
This commit is contained in:
parent
a234bf7f4d
commit
51587209ac
@ -226,8 +226,12 @@ QVariant QgsOgrUtils::getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsField
|
||||
{
|
||||
int size = 0;
|
||||
const GByte *b = OGR_F_GetFieldAsBinary( ogrFet, attIndex, &size );
|
||||
|
||||
// QByteArray::fromRawData is funny. It doesn't take ownership of the data, so we have to explicitly call
|
||||
// detach on it to force a copy which owns the data
|
||||
QByteArray ba = QByteArray::fromRawData( reinterpret_cast<const char *>( b ), size );
|
||||
ba.detach();
|
||||
|
||||
value = ba;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user