wjwwood / serial

Cross-platform, Serial Port library written in C++
http://wjwwood.github.com/serial/
MIT License
2.11k stars 1.02k forks source link

Does it make sense to close the Serial object upon destruction ? #273

Closed Hish15 closed 2 years ago

Hish15 commented 2 years ago

https://github.com/wjwwood/serial/blob/69e0372cf0d3796e84ce9a09aff1d74496f68720/src/serial.cc#L77

The current behavior is to delete an underlaying pointer, this does the job, but can lead to an exception on some cases.

Hish15 commented 2 years ago

I realized that delete pimpl_ does call pimpl_ destructor which calls pimpl_::close.

sudotamm commented 1 year ago

It will crash if throw exception not been catched when delete pimpl_, how do you avoid this? @Hish15

Hish15 commented 1 year ago

Hello @sudotamm, I'm an user of this not a maintainer. What you say is right, the delete pimpl_ calls pimpl_::close which is not noexcept... You might want to open an issue/discussion