From 27b7e7c6a9ca83457f87461a83210d9466eff77a Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 25 Mar 2019 14:01:50 +0100 Subject: [PATCH] Fix for orbital bug: using delete for memory created by minz. --- src/libslic3r/Rasterizer/Rasterizer.cpp | 5 +++++ src/libslic3r/Rasterizer/Rasterizer.hpp | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Rasterizer/Rasterizer.cpp b/src/libslic3r/Rasterizer/Rasterizer.cpp index dd6084b99..60cbb1b79 100644 --- a/src/libslic3r/Rasterizer/Rasterizer.cpp +++ b/src/libslic3r/Rasterizer/Rasterizer.cpp @@ -246,4 +246,9 @@ RawBytes Raster::save(Raster::Compression comp) return std::move(ret); } +void RawBytes::MinzDeleter::operator()(uint8_t *rawptr) +{ + MZ_FREE(rawptr); +} + } diff --git a/src/libslic3r/Rasterizer/Rasterizer.hpp b/src/libslic3r/Rasterizer/Rasterizer.hpp index 1f548ad47..1cb0f918c 100644 --- a/src/libslic3r/Rasterizer/Rasterizer.hpp +++ b/src/libslic3r/Rasterizer/Rasterizer.hpp @@ -11,8 +11,14 @@ namespace Slic3r { class ExPolygon; // Raw byte buffer paired with its size. Suitable for compressed PNG data. -struct RawBytes { - std::unique_ptr buffer = nullptr; +class RawBytes { + class MinzDeleter { + public: + void operator()(std::uint8_t *rawptr); + }; +public: + + std::unique_ptr buffer = nullptr; size_t size = 0; // FIXME: the following is needed for MSVC2013 compatibility