If there is scheduled notification, we must delete it
to avoid using destroyed subscriptions.
ASTERISK-29906
Change-Id: I1c644e5e15a8fe43eed8e4f9112f113cbf87a40f
new_root->version = old_root->version;
sub_tree->root = new_root;
sub_tree->generate_initial_notify = 1;
+
+ /* If there is scheduled notification need to delete it to avoid use old subscriptions */
+ if (sub_tree->notify_sched_id > -1) {
+ AST_SCHED_DEL_UNREF(sched, sub_tree->notify_sched_id, ao2_ref(sub_tree, -1));
+ sub_tree->send_scheduled_notify = 0;
+ }
shutdown_subscriptions(old_root);
destroy_subscriptions(old_root);
} else {