File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,11 @@ class QwOLEDCustom : public QwGrSSD1306 {
78
78
default_address = kOLEDCustomDefaultDefaultAddress ;
79
79
};
80
80
81
- ~QwOLEDCustom (){if (m_graphicsBuffer != nullptr ) delete m_graphicsBuffer;};
81
+ ~QwOLEDCustom ()
82
+ {
83
+ if (m_graphicsBuffer != nullptr )
84
+ delete[] m_graphicsBuffer;
85
+ };
82
86
83
87
// set up the specific device settings
84
88
bool init (void )
@@ -90,8 +94,9 @@ class QwOLEDCustom : public QwGrSSD1306 {
90
94
setVcomDeselect (vcomDeselect);
91
95
setContrast (contrast);
92
96
93
- if (m_graphicsBuffer == nullptr )
94
- m_graphicsBuffer = new uint8_t [(uint16_t )displayWidth * (uint16_t )displayHeight / 8 ];
97
+ if (m_graphicsBuffer != nullptr )
98
+ delete[] m_graphicsBuffer;
99
+ m_graphicsBuffer = new uint8_t [(uint16_t )displayWidth * (uint16_t )displayHeight / 8 ];
95
100
setBuffer (m_graphicsBuffer); // The buffer to use
96
101
97
102
// Call the super class to do all the work
You can’t perform that action at this time.
0 commit comments