GNOME Bugzilla – Bug 572480
unref and copy functions should not be macros
Last modified: 2009-02-22 17:53:55 UTC
unref and copy functions are sometimes used as function pointers for example in the case of g_hash_table_new_full as a GDestroyNotify function. Currently GstBuffer, GstEvent, GstMessage and GstQuery define their respective unref and copy functions as macros, making use of gst_mini_object_unref/copy. This approach works very well for most cases, except for some automatically generated bindings (currently Vala), where the memory management semantics are defined declaratively. The possible solutions would be to either convert all the macros into static inline function, or change the signature of gst_mini_object_unref to take a void* instead of a GstMiniObject*
Created attachment 129093 [details] [review] Replace the unref/copy functions with a static inline function The attached patch converts the macros into static inline functions, and fixes 2 small bugs where incorrect unref functions where used.
commit cd1f18bd128319bcfd117bbceab92c8fcb6957c3 Author: Ali Sabil <ali.sabil@gmail.com> Date: Sun Feb 22 18:53:10 2009 +0100 Use the correct unref function commit 136cfb3bed4aa4d9e4b4ebd20c9562078addd9a7 Author: Ali Sabil <ali.sabil@gmail.com> Date: Sun Feb 22 18:51:08 2009 +0100 Convert unref/copy functions of GstMiniObject subclasses to static inline fu unref and copy functions are sometimes used as function pointers for example in the case of g_hash_table_new_full as a GDestroyNotify function. Currently GstBuffer, GstEvent, GstMessage and GstQuery define their respective unref and copy functions as macros, making use of gst_mini_object_unref/copy. This approach works very well for most cases, except for some automatically generated bindings (currently Vala), where the memory management semantics are defined declaratively. The possible solutions would be to either convert all the macros into static inline function, or change the signature of gst_mini_object_unref to take a void* instead of a GstMiniObject*. Fixes bug #572480.