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 645817 - GeglMatrix is not introspectable by Gobject Introspection
GeglMatrix is not introspectable by Gobject Introspection
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks: 645822
 
 
Reported: 2011-03-27 11:21 UTC by Jon Nordby
Modified: 2011-04-11 12:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jon Nordby 2011-03-27 11:21:54 UTC
This because multi-dimensional arrays are currently not supported, see bug 567993

A possible workaround is to wrap the gdouble [3][3] in an opaque struct, and change the gegl_matrix functions to accept a pointer to such a struct. New matrices could be constructed using a new function that takes 9 doubles, and set/get_data functions could allow access to the data array.
This would introduce an ABI break.

Another alternative is to change the 3x3 array to a single dimension array with 9 elements. This should be supported by GI and might not be an ABI break (have to consult a C reference).
Comment 1 Jon Nordby 2011-03-28 20:35:41 UTC
Taking. Will change to a struct matching GimpMatrix2/3:
http://developer.gimp.org/api/2.0/libgimpmath/libgimpmath-GimpMatrix.html
Comment 3 Massimo 2011-04-09 11:32:30 UTC
The commit referenced above introduced few new memory leaks.

In operations/{affine/affine,external/{path,vector-{fill,stroke}}}.c
there are calls to 'gegl_matrix3_new' (and g_new(GeglMatrix2, 1)) not paired with 
the corresponding g_free.

Not that it is necessary to allocate the matrix on the heap, but in that case,
when done, it is better to release the memory, since these operations are shared
objects and not plug-ins executed in a separate short living process.

BTW in operations/external/{path,vector-{fill,stroke}}.c there is shortage of 
calls to 'cairo_surface_destroy' and 'cairo_destroy' as well.
Comment 4 Jon Nordby 2011-04-09 13:13:22 UTC
Thanks, you are very right. How sloppy of me. Fixed in http://git.gnome.org/browse/gegl/commit/?id=d5ed2b9533daa998de291a6241a1d5f080852dbd

Also pushed documentation fixes to make it clear that gegl_path_set_matrix copies the matrix.

Could you provide a patch for the cairo context/surface leaks and attach it to a bugreport?
Comment 5 Massimo 2011-04-11 11:46:43 UTC
I don't think it is worth, probably it is dead code, 
I've seen there's a git branch 'paint-system' that seems 
the future of these operations.

Anyway the memory leak is only a problem among many others, 
taking the function 'process' in operations/external/path.c 
as reference:

1) Each thread has its own local GStaticMutex. 
   Unless a mutex is not needed there, that's wrong because 
   locking it will not synchronize anything.

2) The input GeglBuffer loses its high bit depth as soon as 
   gegl_buffer_linear_close performs the conversion 
   "B'aG'aR'aA u8" -> "RaGaBaA float"

3) It is missing a call to cairo_surface_finish or 
   cairo_surface_flush before reading the output of 
   cairo_fill.

4) the babl_format ("B'aG'aR'aA u8") corresponding to 
   cairo_surface's format is endianness-dependent.

5) before cairo_set_source_rgba there is no color 
   conversion: a path having the same mid-tone stroke 
   and fill color is rendered with two different colors.

6) if you call cairo_set_fill_rule in 'process', 
   you should in 'detect' as well.
Comment 6 Øyvind Kolås (pippin) 2011-04-11 12:21:34 UTC
please open a separate bug report for the cairo op issues, they are not dead code - but discussion of them do not belong in this bug report.