I understand that this error is because of the context not existing yet when the teardown happens, but I don't think that this should be an issue in the case of just destroying a control panel object that for one reason or another hasn't been set up.
When the ControlPanel desctructor is called before cp has been set up, the application will fail and give an assertion error:
assertion "TO_OSDP(ctx)->_magic == OSDP_CTX_MAGIC" failed: file "osdp_cp.c", line 1329, function: osdp_cp_teardown
I understand that this error is because of the context not existing yet when the teardown happens, but I don't think that this should be an issue in the case of just destroying a control panel object that for one reason or another hasn't been set up.