From 8c588d04fcb72c2a9b298f73f7085a1bed46fa40 Mon Sep 17 00:00:00 2001 From: Loïc Collignon Date: Wed, 27 Feb 2019 17:44:37 +0100 Subject: Added a tutorial and fix few errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/afb/c++/binding-wrap.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/afb/c++/binding-wrap.hpp') 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_); } -- cgit 1.2.3-korg