Skip to content
Permalink
Browse files

QgsSvgCache::svgAsPicture(): make sure the returned picture is not sh…

…ared (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
  • Loading branch information
rouault committed Jun 1, 2018
1 parent bd65fc6 commit 75b7edf1d211cd136fb54d2216cfea6e9fd2e120
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/core/symbology/qgssvgcache.cpp
@@ -182,8 +182,12 @@ QPicture QgsSvgCache::svgAsPicture( const QString &path, double size, const QCol
trimToMaximumSize();
}

QPicture p = *( currentEntry->picture );
p.detach();
QPicture p;
// For some reason p.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.
p.setData( currentEntry->picture->data(), currentEntry->picture->size() );
return p;
}

0 comments on commit 75b7edf

Please sign in to comment.
You can’t perform that action at this time.