From 46fae978d74fc7d72f188152c7f37542a07e0ff3 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 26 Aug 2016 16:54:23 +0300 Subject: [PATCH] Allow unbinding of command manager callbacks by passing null. --- source/Command.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/Command.hpp b/source/Command.hpp index a78bc4a4..79fa60ef 100644 --- a/source/Command.hpp +++ b/source/Command.hpp @@ -625,8 +625,13 @@ public: */ void SetOnFail(Object & env, Function & func) { + // Are we supposed to unbind current callback? + if (func.IsNull()) + { + m_OnFail.ReleaseGently(); + } // Was there a custom environment specified? - if (env.IsNull()) + else if (env.IsNull()) { m_OnFail = func; } @@ -649,6 +654,11 @@ public: */ void SetOnAuth(Object & env, Function & func) { + // Are we supposed to unbind current callback? + if (func.IsNull()) + { + m_OnAuth.ReleaseGently(); + } // Was there a custom environment specified? if (env.IsNull()) {