After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 572480 - unref and copy functions should not be macros
unref and copy functions should not be macros
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-19 19:53 UTC by Ali Sabil
Modified: 2009-02-22 17:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Replace the unref/copy functions with a static inline function (6.96 KB, patch)
2009-02-19 19:54 UTC, Ali Sabil
committed Details | Review

Description Ali Sabil 2009-02-19 19:53:04 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*
Comment 1 Ali Sabil 2009-02-19 19:54:50 UTC
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.
Comment 2 Sebastian Dröge (slomo) 2009-02-22 17:53:55 UTC
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.