summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2022-03-20 15:33:29 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2022-03-20 15:35:04 +0100
commit7758020edb65b5dc2197110b7d70b48764e940a6 (patch)
tree7d3e31423c7352b8ef7402f1433bfdb1df686b1c
parent791fc7d6eb7e01d6886c43a8c8cc0fe43cac2e8a (diff)
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.
-rw-r--r--src/Fl_Tiled_Image.cxx3
1 files changed, 1 insertions, 2 deletions
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);
}