sr_session_trigger_set(sess, NULL) is a valid thing to do, meaning that
any trigger shall be removed from the session.
This closes bugs #491 and #496.
void Session::set_trigger(shared_ptr<Trigger> trigger)
{
- check(sr_session_trigger_set(_structure, trigger->_structure));
+ if (!trigger)
+ // Set NULL trigger, i.e. remove any trigger from the session.
+ check(sr_session_trigger_set(_structure, NULL));
+ else
+ check(sr_session_trigger_set(_structure, trigger->_structure));
_trigger = trigger;
}