Skip to content

Commit

Permalink
QgsSvgCache::svgAsPicture(): make sure the returned picture is not sh…
Browse files Browse the repository at this point in the history
…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 75b7edf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/symbology/qgssvgcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 75b7edf

Please sign in to comment.