pygobject-object: fix memory corruption around list of closures

Merged Mikhail Fludkov requested to merge into master

#158 (closed)

The memory corruption occurs because of the race while accessing PyGObjectData->closures list.

Protect PyGObjectData->closures by GIL in pygobject_unwatch_closure. Despite the fact that we don't call any Python API in the function. We use GIL to be sure that PyGObjectData->closures list stays intact while GC iterating the list inside pygobject_traverse. Otherwise we can segfault while trying to call 'visit' function on an object that was just freed in pygobject_unwatch_closure.

Merge request reports