arkhipenko / TaskScheduler

Cooperative multitasking for Arduino, ESPx, STM32, nRF and other microcontrollers
http://playground.arduino.cc/Code/TaskScheduler
BSD 3-Clause "New" or "Revised" License
1.22k stars 224 forks source link

Virtual destructor for TASK_OO_CALLBACKS #86

Closed moritz89 closed 4 years ago

moritz89 commented 4 years ago

In the case of inheriting from the Task class, the destructor should be virtual to avoid undefined behavior. This came to light from a GCC warning:

src/tasks/base_task.cpp:34:12: warning: deleting object of abstract class type 'Task' which has non-virtual destructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]

Would you like me to create a pull request, since the change only requires adding the virtual keyword to the TaskSchedulerDeclarations.h file on line 155?

arkhipenko commented 4 years ago

Pushed to testing branch

arkhipenko commented 4 years ago

merged into 3.1.3