Missing virtual destructor for `Print` class
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- api, embedded-iot
Research direction
Read the referenced api/Print.h declaration and review linked pull request #218 to understand the proposed change. Done means the Modem.cpp example no longer produces the non-virtual-destructor warning or the associated undefined-behavior concern.
Written by the indexing model from the issue text.
Description
Description
Missing virtual destructor - memory leak and UB
Environment
First found on R4, but it is general
Current behavior
Warning while compiling sketch, possible UB.
packages/arduino/hardware/renesas_uno/1.5.0/libraries/WiFiS3/src/Modem.cpp: In destructor 'ModemClass::~ModemClass()':
packages/arduino/hardware/renesas_uno/1.5.0/libraries/WiFiS3/src/Modem.cpp:27:14: warning: deleting object of polymorphic
class type 'UART' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
delete _serial;
ModemClass extends Serial which extends Print.
Expected behavior
no warnings
Additional information
This class is very base class of all streams and other i/o components.
- Dominant language
- C++
- Stars
- 306
- Forks
- 150
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from arduino/ArduinoCore-API
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
arduino/ArduinoCore-API#261 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 48/100
arduino/ArduinoCore-API#251 · 1 comment ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
arduino/ArduinoCore-API#250 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
arduino/ArduinoCore-API#249 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
arduino/ArduinoCore-API#247 · 1 comment ·
All issues in arduino/ArduinoCore-API
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·