graphene icon indicating copy to clipboard operation
graphene copied to clipboard

Add support for using g_autoptr with graphene types

Open tintou opened this issue 3 years ago • 2 comments

Proposed changes:

  • add g_autoptr(graphene_$TYPE_t) support

This is handy when writing an application.

tintou avatar Sep 16 '22 15:09 tintou

To be honest, if you're writing a C application I'd recommend to use Graphene types on the stack instead of using the heap; using g_autoptr works only if you're copying data from out of properties or signals.

ebassi avatar Sep 16 '22 15:09 ebassi

Yes.

In my use-case I have a GList of points so I wanted to use a g_autolist(graphene_point_t) my_list;

tintou avatar Sep 16 '22 15:09 tintou

I'm sorry to say, but a linked list of points is probably the most inefficient way you could find. I'd recommend a GArray, if you wanted to have the equivalent of a resizing C array of graphene_point_t.

Having said that, I don't have any particular objections to this pull request.

ebassi avatar Dec 18 '22 14:12 ebassi