Skip to content

Commit 75b7edf

Browse files
committedJun 1, 2018
QgsSvgCache::svgAsPicture(): make sure the returned picture is not shared (fixes #18996)
For some reason QPicture.detach() doesn't seem to always work as intended, at least with QT 5.5 on Ubuntu 16.04 Serialization/deserialization is a safe way to be ensured we don't share a copy. Relates to a6eea72
1 parent bd65fc6 commit 75b7edf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎src/core/symbology/qgssvgcache.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,12 @@ QPicture QgsSvgCache::svgAsPicture( const QString &path, double size, const QCol
182182
trimToMaximumSize();
183183
}
184184

185-
QPicture p = *( currentEntry->picture );
186-
p.detach();
185+
QPicture p;
186+
// For some reason p.detach() doesn't seem to always work as intended, at
187+
// least with QT 5.5 on Ubuntu 16.04
188+
// Serialization/deserialization is a safe way to be ensured we don't
189+
// share a copy.
190+
p.setData( currentEntry->picture->data(), currentEntry->picture->size() );
187191
return p;
188192
}
189193

0 commit comments

Comments
 (0)