• Simon McVittie's avatar
    codegen: make g_autoptr for the GInterface conditional · 1c6cd5f0
    Simon McVittie authored
    Some GNOME projects unconditionally work around the generated code's
    lack of g_autoptr support by defining the autoptr cleanup function
    themselves, which is not forward-compatible; as a result, commit
    cbbcaa4d broke them. Do not define the cleanup function unless the
    including app "opts in" to newer APIs via GLIB_VERSION_MAX_ALLOWED.
    
    Projects requiring compatibility with GLib < 2.49 can get a
    forward-compatible g_autoptr for a generated GInterface type found in
    a library, for example ExampleAnimal in the GIO tests, by declaring
    and using a typedef with a distinct name outside the library's
    namespace:
    
        typedef AutoExampleAnimal ExampleAnimal;
        G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoExampleAnimal, g_object_unref)
    
        ...
    
        g_autoptr (AutoExampleAnimal) animal = NULL;
    
        /* returns ExampleAnimal * */
        animal = example_animal_proxy_new_sync (...);
        /* takes ExampleAnimal * first argument */
        example_animal_call_poke_sync (animal, ...);
    Signed-off-by: Simon McVittie's avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=763379Reviewed-by: Colin Walters's avatarColin Walters <walters@verbum.org>
    Reviewed-by: 's avatarEmmanuele Bassi <ebassi@gnome.org>
    1c6cd5f0
Name
Last commit
Last update
..
.gitignore Loading commit data...
Makefile.am Loading commit data...
__init__.py Loading commit data...
codegen.py Loading commit data...
codegen_docbook.py Loading commit data...
codegen_main.py Loading commit data...
config.py.in Loading commit data...
dbustypes.py Loading commit data...
gdbus-codegen.in Loading commit data...
parser.py Loading commit data...
utils.py Loading commit data...