mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2026-10-26 22:10:52 +00:00
Give Adafruit_GFX a virtual destructor except on AVR
Deleting a canvas or display through an Adafruit_GFX pointer called only the base destructor, so the canvas buffer leaked (#369). AVR is left out because a virtual destructor links malloc and free into display sketches that never use the heap (+602 bytes on an Uno). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
85ce269b27
commit
019a40791e
1 file changed
+5
@@ -19,6 +19,11 @@ class Adafruit_GFX : public Print {
|
||||
|
||||
public:
|
||||
Adafruit_GFX(int16_t w, int16_t h); // Constructor
|
||||
#if !defined(__AVR__)
|
||||
// Virtual so deleting a canvas or display through an Adafruit_GFX pointer
|
||||
// frees it. Skipped on AVR, where it links malloc/free into every sketch.
|
||||
virtual ~Adafruit_GFX() {}
|
||||
#endif
|
||||
|
||||
/**********************************************************************/
|
||||
/*!
|
||||
|
||||
Reference in new issue
Block a user