From 7758020edb65b5dc2197110b7d70b48764e940a6 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 20 Mar 2022 15:33:29 +0100 Subject: Fix Fl_Tiled_Image::copy(int W, int H) Remove false "optimization" that would return the same pointer if the requested width and height are the same. Note: copy() must always return a new image (this is the expected behavior of copy). Otherwise deleting one of the objects (either the source or the copy) would delete the other one as well. --- src/Fl_Tiled_Image.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/Fl_Tiled_Image.cxx b/src/Fl_Tiled_Image.cxx index 12bd7a659..a97081e6a 100644 --- a/src/Fl_Tiled_Image.cxx +++ b/src/Fl_Tiled_Image.cxx @@ -80,8 +80,7 @@ Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *i, // I - Image to tile Fl_Image * // O - New image Fl_Tiled_Image::copy(int W, // I - New width int H) { // I - New height - if (W == w() && H == h()) return this; - else return new Fl_Tiled_Image(image_, W, H); + return new Fl_Tiled_Image(image_, W, H); } -- cgit v1.2.3