From b09975b5f7c84fda66857d5a3c883aa60671c5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 5 Sep 2015 14:18:34 +0200 Subject: [PATCH] Trade: fix accesses of uninitialized union members. --- src/Magnum/Trade/ImageData.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Magnum/Trade/ImageData.h b/src/Magnum/Trade/ImageData.h index 239e8544f..bf59087b9 100644 --- a/src/Magnum/Trade/ImageData.h +++ b/src/Magnum/Trade/ImageData.h @@ -287,16 +287,17 @@ template ImageData::ImageData( template inline ImageData::ImageData(const CompressedPixelFormat format, const VectorTypeFor& size, Containers::Array&& data): ImageData{{}, format, size, std::move(data)} {} #endif -template inline ImageData::ImageData(ImageData&& other) noexcept: _compressed{std::move(other._compressed)}, _type{std::move(other._type)}, _size{std::move(other._size)}, _data{std::move(other._data)} { +template inline ImageData::ImageData(ImageData&& other) noexcept: _compressed{std::move(other._compressed)}, _size{std::move(other._size)}, _data{std::move(other._data)} { if(_compressed) { #ifndef MAGNUM_TARGET_GLES - _compressedStorage = std::move(other._compressedStorage); + new(&_compressedStorage) CompressedPixelStorage{std::move(other._compressedStorage)}; #endif _compressedFormat = std::move(other._compressedFormat); } else { - _storage = std::move(other._storage); + new(&_storage) PixelStorage{std::move(other._storage)}; _format = std::move(other._format); + _type = std::move(other._type); } other._size = {};