Use session mutex when adding a contributing source to avoid potential crash

Merged Mickaël Turnel requested to merge fix/csrc-crash into master

(cherry picked from commit b3c8bde4)

Merge request reports