From d43db99e86e495e3848ba0b798ea082982b20b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 7 Sep 2013 21:36:49 +0200 Subject: [PATCH] MagnumFont[Converter]: adapted to Magnum changes. Forgot to call `delete` here too. --- src/Plugins/MagnumFont/MagnumFont.cpp | 6 ++---- .../MagnumFontConverter/Test/MagnumFontConverterTest.cpp | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Plugins/MagnumFont/MagnumFont.cpp b/src/Plugins/MagnumFont/MagnumFont.cpp index c14fef1f0..8fdbeedf9 100644 --- a/src/Plugins/MagnumFont/MagnumFont.cpp +++ b/src/Plugins/MagnumFont/MagnumFont.cpp @@ -102,14 +102,13 @@ void MagnumFont::doOpenData(const std::vector image = importer.image2D(0); if(!image) { Error() << "Text::MagnumFont::openData(): cannot load image file"; return; } openInternal(std::move(conf), std::move(*image)); - delete image; } void MagnumFont::doOpenFile(const std::string& filename, Float) { @@ -134,14 +133,13 @@ void MagnumFont::doOpenFile(const std::string& filename, Float) { Error() << "Text::MagnumFont::openFile(): cannot open image file" << imageFilename; return; } - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); if(!image) { Error() << "Text::MagnumFont::openFile(): cannot load image file"; return; } openInternal(std::move(conf), std::move(*image)); - delete image; } void MagnumFont::openInternal(Utility::Configuration&& conf, Trade::ImageData2D&& image) { diff --git a/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp b/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp index 2ef161a5a..25e37df0c 100644 --- a/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp +++ b/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp @@ -88,7 +88,8 @@ void MagnumFontConverterTest::exportFont() { /* Verify font image, no need to test image contents, as the image is garbage anyway */ Trade::TgaImporter importer; CORRADE_VERIFY(importer.openFile(Utility::Directory::join(MAGNUMFONTCONVERTER_TEST_WRITE_DIR, "font.tga"))); - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); + CORRADE_VERIFY(image); CORRADE_COMPARE(image->size(), Vector2i(256)); CORRADE_COMPARE(image->format(), ImageFormat::Red); CORRADE_COMPARE(image->type(), ImageType::UnsignedByte);