aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-07 18:03:37 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-05 16:22:47 +0200
commit523113d80d1304346f685f530089b14a7df29d07 (patch)
treea47b7540f473bd52d09e55ae9a0d0c2caf7b6822
parentafbbcafbf00b968a025e6978234267f8385534d3 (diff)
Fix: release json_object
This ensure that the json_object is correctly released after. Then after that the call will have enough reference count. Also fix a GCC warning using "if" instead of trigraph Change-Id: I41776d9009465f48f6c0b236614c0a32244f5cfb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--signal-composer-binding/signal.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/signal-composer-binding/signal.cpp b/signal-composer-binding/signal.cpp
index 63bc0a8..f248eae 100644
--- a/signal-composer-binding/signal.cpp
+++ b/signal-composer-binding/signal.cpp
@@ -355,7 +355,10 @@ void Signal::onReceivedCB(json_object *eventJ)
source.api = nullptr; // We use binding v2, no dynamic API.
source.request = {nullptr, nullptr};
source.context = (void*)get_context();
- onReceived_ ? ActionExecOne(&source, onReceived_, eventJ) : defaultReceivedCB(eventJ);
+ if (onReceived_)
+ ActionExecOne(&source, onReceived_, json_object_get(eventJ));
+ else
+ defaultReceivedCB(eventJ);
}
/// @brief Make a Signal observer observes Signals observables