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 <liang.qi@theqtcompany.com>
bb10
Ulf Hermann 2015-03-12 16:59:00 +01:00 committed by Liang Qi
parent 88851fb3b0
commit 5c2df051cd
1 changed files with 1 additions and 2 deletions

View File

@ -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;