Why extra unref() in runtime_source_add_delete example

In the runtime source add / delete sample here deepstream_reference_apps/runtime_source_add_delete at master · NVIDIA-AI-IOT/deepstream_reference_apps · GitHub

The function stop_release_source() sets the state of the source bin it wants to remove to GST_STATE_NULL and then based on the return value from this state change it either:

On GST_STATE_CHANGE_SUCCESS – get the streammux sinkpad and send gst_event_new_flush_stop (FALSE); release the sinkpad; unref the sinkpad and finally remove the source bin from the pipeline.

On GST_STATE_CHANGE_ASYNC – it does the same; get the streammux sinkpad gst_event_new_flush_stop (FALSE); release the sinkpad; unref the sinkpad and finally remove the source bin from the pipeline. BUT… It does an additional step: It unrefs() the source bin.

Why do you unref() the source bin on GST_STATE_CHANGE_ASYNC and not on GST_STATE_CHANGE_SUCCESS.

Is that by-design or a mistake?

Thanks.
We need to add unref in STATE_CHANGE_SUCCESS as well. We will fix it.