diff options
author | Loïc Collignon <loic.collignon@iot.bzh> | 2019-02-27 17:44:37 +0100 |
---|---|---|
committer | Loïc Collignon <loic.collignon@iot.bzh> | 2019-02-27 17:54:26 +0100 |
commit | 8c588d04fcb72c2a9b298f73f7085a1bed46fa40 (patch) | |
tree | a591065da4cb9f12239c88a3cb1abbb8a34e3258 /include/afb/c++/binding-wrap.hpp | |
parent | 9271575a7dd2b783eda8bcc7f06479ee20abbd99 (diff) |
Added a tutorial and fix few errorssandbox/ctxnop/binding-object
Added the tuto-5 that show how to benefit from the new 'binding-object'
header. Fix few errors that can cause segfault when dealing with events
and use the right afb::req object for verbs.
Change-Id: I0563dd72a2843b2b54c2e40398ba129aac05ff0c
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'include/afb/c++/binding-wrap.hpp')
-rw-r--r-- | include/afb/c++/binding-wrap.hpp | 3 |
1 files changed, 2 insertions, 1 deletions
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_); } |