GNOME Bugzilla – Bug 584047
Use cleanup list to release allocated arguments.
Last modified: 2018-01-27 11:43:14 UTC
Initially discussed in the comments to bug 582228. To properly support TRANSFER_CONTAINER and bare C arrays-of-(objects), we should refactor the release code to implement a post-invocation cleanup list. Cleanups are something like: struct _Cleanup { enum { CLEANUP_G_FREE, CLEANUP_G_OBJECT_UNREF, CLEANUP_GI_TYPE, ... } type; gpointer data; } The CLEANUP_GI_TYPE argument uses the existing GI type-driven release method, since that is necessary in any case to release TRANSFER_EVERYTHING out-parameters. When marshaling container types from JavaScript to C, we can add cleanups for the contained objects (unless TRANSFER_CONTAINER or TRANSFER_NONE) as we add them to the container and then add a clean up for the container (unless TRANSFER_NONE).
Should the first element be a GDestroyNotify instead of the enum?
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gjs/issues/44.