From 5c2df051cdf8768424fe250bec99b67844df9a36 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 12 Mar 2015 16:59:00 +0100 Subject: Always overwrite QPixmap data on loadFromData Reusing the previous QPlatformPixmap breaks implicit sharing. It changes the contents for all QPixmaps using the sample QPlatformPixmap. Task-number: QTBUG-43384 Change-Id: Ic0792088daa8c2dcb5d7d311a0fd7415d7b5e097 Reviewed-by: Liang Qi --- src/gui/image/qpixmap.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index db6ae54d26..4ee64cddcd 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -824,8 +824,7 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I return false; } - if (!data) - data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType); + data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType); if (data->fromData(buf, len, format, flags)) return true; -- cgit v1.2.3