diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-01-15 20:14:35 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-01-15 20:14:35 +0100 |
| commit | 02ca05c6b2990ba3401867303ea5c5de0c358897 (patch) | |
| tree | ba9ffb9cf1c4d4284f67c770e016071d0671060a /test/pixmap.cxx | |
| parent | f54c2b3430b60536f99bb98baa4109f1f6b8566d (diff) | |
Fix memory leak warnings by "binding" images
Although the memory "leak" is not really an issue in this demo
program (memory is returned anyway), "fixing" the leak warning
issued by valgrind and address sanitizer demonstrates the new
feature to "bind" images.
Diffstat (limited to 'test/pixmap.cxx')
| -rw-r--r-- | test/pixmap.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/pixmap.cxx b/test/pixmap.cxx index fe79f8758..c8fb54429 100644 --- a/test/pixmap.cxx +++ b/test/pixmap.cxx @@ -1,7 +1,7 @@ // // Pixmap label test program for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -62,8 +62,11 @@ int main(int argc, char **argv) { depixmap = (Fl_Pixmap *)pixmap->copy(); depixmap->inactive(); - b.image(pixmap); - b.deimage(depixmap); + // "bind" images to avoid memory leak reports (valgrind, asan) + // note: these reports are benign because they appear at exit, but anyway + + b.bind_image(pixmap); + b.bind_deimage(depixmap); leftb = new Fl_Toggle_Button(25,50,50,25,"left"); leftb->callback(button_cb); |
