ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
1.98k stars 636 forks source link

Debug BufferOffset #318

Closed ProggyCoder closed 3 years ago

ProggyCoder commented 3 years ago

Proposal: store (and use) output of getBufferOffset() in separate member variable

Reason: getBufferOffset() will be implemented in derived class; by removing (deconstructing) the derived class, the implemented version of getBufferOffset() will be no more available in the deconstructor ~OLEDDisplay()

Background: implementing a temporary instance of derviced class will lead to abort/reboot; behaviour is not recoginizable if the derived class is implemented globally (as is commenly done)

marcelstoer commented 3 years ago

I'm inclined to accept this PR even though the behavior you describe sounds like an extreme corner case. Besides, for consistency reasons the same pattern might possibly have to be applied to other protected functions implemented by derived classes.