diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-12-07 12:07:53 +0000 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-12-08 08:53:54 +0000 |
commit | a71f50edc6431a7d5a8b4a4836e98ca59e6ad7ae (patch) | |
tree | 4096a5d3813c0a301c0234a20af54df6d7ba2f30 /src | |
parent | 25231c40489e54d57998fa44385ad832cc32b30d (diff) |
Revert "Ensure alignment of image-data"
This reverts commit ae8389e19c5804c867b2981311c623003a691474.
The result of malloc should be aligned in any case, and
this change conflicts with the use of realloc on the data elsewhere.
Change-Id: I01773132b240614a2656dd3013490b0df9cd14a7
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qimage.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index da963adae6..0105f1decd 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -149,10 +149,7 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format) d->bytes_per_line = params.bytesPerLine; d->nbytes = params.totalSize; - if (depth == 64) - d->data = (uchar *)new (std::nothrow) quint64[d->nbytes / sizeof(quint64)]; - else // nbytes is known to already be a multipla of 4: - d->data = (uchar *)new (std::nothrow) quint32[d->nbytes / sizeof(quint32)]; + d->data = (uchar *)malloc(d->nbytes); if (!d->data) return nullptr; @@ -168,13 +165,8 @@ QImageData::~QImageData() if (is_cached) QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no)); delete paintEngine; - if (data && own_data) { - // Casting to avoid being theoretically UB: - if (depth == 64) - delete[] (quint64 *)data; - else - delete[] (quint32 *)data; - } + if (data && own_data) + free(data); data = 0; } |