goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
128 stars 69 forks source link

C++ wrapper, only call teardown in destructors if context exists #130

Closed niklasva closed 10 months ago

niklasva commented 10 months ago

Fixes #129.

Adds a check to the destructors of OSDP::ControlPanel and OSDP::Peripheral to see if the context has been set during the object's lifetime. This decides whether a teardown should happen or not. An uninitialized object would otherwise fail when being destroyed.