Fix boxed copies

Merged Mathieu Duponchelle requested to merge mathieudu/pygobject:fix_boxed_copies into master

Many gstreamer virtual functions will pass a boxed object as transfer-none for implementations to modify. Since 85175047 , a boxed copy was automatically made when marshalling arguments to python in the case of closures, and return values and out arguments in the case of regular invocations.

While this ensures memory access violations cannot happen, it also means closures had to operate on copies of the boxed structures, thus rendering many gstreamer base classes mostly unusable from python (see eg

This set of commits reverts the original change, then makes it so the copy only occurs at to_py_cleanup time, ie after the call is over. This means the test introduced in still passes, and the expected behaviour is preserved.

Merge request reports