X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fafb%2Fc%2B%2B%2Fbinding-wrap.hpp;h=ae0e5eeb786984a3fb69badcf67eea24806b0c61;hb=8c588d04fcb72c2a9b298f73f7085a1bed46fa40;hp=04f4add1995c6f72d57912080b39e1cc2e023aa9;hpb=9271575a7dd2b783eda8bcc7f06479ee20abbd99;p=src%2Fapp-framework-binder.git diff --git a/include/afb/c++/binding-wrap.hpp b/include/afb/c++/binding-wrap.hpp index 04f4add1..ae0e5eeb 100644 --- a/include/afb/c++/binding-wrap.hpp +++ b/include/afb/c++/binding-wrap.hpp @@ -90,6 +90,7 @@ bool callsync(const char *api, const char *verb, struct json_object *args, struc /* apis */ class api { +protected: afb_api_t api_; public: using call_cb = void (*)(void *closure, struct json_object *object, const char *error, const char *info, afb_api_t api); @@ -406,7 +407,7 @@ inline bool event::is_valid() const { return afb_event_is_valid(event_); } inline int event::broadcast(json_object *object) const { return afb_event_broadcast(event_, object); } inline int event::push(json_object *object) const { return afb_event_push(event_, object); } -inline void event::unref() { afb_event_unref(event_); event_ = nullptr; } +inline void event::unref() { if (event_) { afb_event_unref(event_); } event_ = nullptr; } inline void event::addref() { afb_event_addref(event_); } inline const char *event::name() const { return afb_event_name(event_); }