diff --git a/drivers/display_st25dvdiscovery.h b/drivers/display_st25dvdiscovery.h index 5ee40f0f32f856a426cc325378cde04914c49671..148d7f8fb1b59efb25dab555ec0b0d2d5d3dcc19 100644 --- a/drivers/display_st25dvdiscovery.h +++ b/drivers/display_st25dvdiscovery.h @@ -216,7 +216,7 @@ public: /** * Default constructor, results in an invalid iterator. */ - pixel_iterator(): pixelLeft(0) {} + pixel_iterator(): pixelLeft(0), wr(nullptr) {} /** * Set a pixel and move the pointer to the next one @@ -275,13 +275,18 @@ public: */ void invalidate() {} + ~pixel_iterator() + { + if(wr) delete wr; + } + private: /** * Constructor * \param pixelLeft number of remaining pixels */ - pixel_iterator(unsigned int pixelLeft): pixelLeft(pixelLeft) + pixel_iterator(unsigned int pixelLeft): pixelLeft(pixelLeft) { wr = new Transaction(0x2c); } @@ -408,4 +413,4 @@ private: } //namespace mxgui #endif //_BOARD_STM32F415VG_ST25DVDISCOVERY -#endif //DISPLAY_ST25DVDISCOVERY_H \ No newline at end of file +#endif //DISPLAY_ST25DVDISCOVERY_H