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 790675 - The gegl_operation_context_get_source method name is confusing
The gegl_operation_context_get_source method name is confusing
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: core
git master
Other All
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2017-11-21 17:40 UTC by Debarshi Ray
Modified: 2017-11-26 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
operations/common/exp-combine: Don't leak the source buffers (928 bytes, patch)
2017-11-21 17:49 UTC, Debarshi Ray
none Details | Review
operation-context: Replace ambiguous method name (3.12 KB, patch)
2017-11-21 17:49 UTC, Debarshi Ray
committed Details | Review
operations/common/exp-combine: Don't leak the source buffers (995 bytes, patch)
2017-11-21 17:56 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-11-21 17:40:25 UTC
The gegl_operation_context_get_source method is a thin wrapper around gegl_operation_context_get_object. Therefore it can be used to get both the input and output buffers, which doesn't match with the "source" in its name. Secondly, unlike most "get" methods it returns "transfer full", not "transfer none", which can cause reference counting bugs.
Comment 1 Debarshi Ray 2017-11-21 17:49:20 UTC
Created attachment 364135 [details] [review]
operations/common/exp-combine: Don't leak the source buffers
Comment 2 Debarshi Ray 2017-11-21 17:49:45 UTC
Created attachment 364136 [details] [review]
operation-context: Replace ambiguous method name
Comment 3 Debarshi Ray 2017-11-21 17:56:04 UTC
Created attachment 364137 [details] [review]
operations/common/exp-combine: Don't leak the source buffers
Comment 4 Øyvind Kolås (pippin) 2017-11-21 19:15:22 UTC
commit 6e90b8d4db1ffcdaf389bfe825969fc2e565d957
Author: Øyvind Kolås <pippin@gimp.org>
Date:   Tue Nov 21 19:58:41 2017 +0100

    operations/transform: s/_context_get_source/_context_dup_object/

commit 3206847c3f105f9732b0f9a23cbbe8315bcc57c8
Author: Øyvind Kolås <pippin@gimp.org>
Date:   Tue Nov 21 19:58:00 2017 +0100

    operations/common-gpl3+: s/_context_get_source/_context_dup_object/

commit 05ce963169eb6d8799044b0c588d38e58c0118d6
Author: Øyvind Kolås <pippin@gimp.org>
Date:   Tue Nov 21 19:57:46 2017 +0100

    operations/common: s/_context_get_source/_context_dup_object/

commit 9ba4e278fba0aa20e75e81919c11758a1fcbf3ae
Author: Øyvind Kolås <pippin@gimp.org>
Date:   Tue Nov 21 19:57:36 2017 +0100

    operations/core: s/_context_get_source/_context_dup_object/

commit a42ac5996cc55db9270a34349ccee04ac53997db
Author: Øyvind Kolås <pippin@gimp.org>
Date:   Tue Nov 21 19:57:23 2017 +0100

    gegl/operation: s/_context_get_source/_context_dup_object/

commit 8d362be8b1531b58aea9c57be9508989673e55dd
Author: Debarshi Ray <debarshir@gnome.org>
Date:   Tue Nov 21 18:34:03 2017 +0100

    operation-context: Replace ambiguous method name
    
    The gegl_operation_context_get_source method is misleading. It is a
    thin wrapper around gegl_operation_context_get_object. Therefore it
    can be used to get both the input and output buffers, which doesn't
    match with the "source" in its name. Secondly, unlike most "get"
    methods it returns "transfer full", not "transfer none", which can
    cause reference counting bugs.
    
    Address this by deprecating gegl_operation_context_get_source and
    adding a gegl_operation_context_dup_object method.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790675

commit 999f8ecbbc5a4f1ca3ccdb095589af0b2b711c75
Author: Debarshi Ray <debarshir@gnome.org>
Date:   Tue Nov 21 18:14:47 2017 +0100

    operations/common/exp-combine: Don't leak the source buffers
    
    Contrary to its name, gegl_operation_context_get_source returns
    "transfer full", not "transfer none".
Comment 5 Massimo 2017-11-26 07:47:04 UTC
(In reply to Øyvind Kolås (pippin) from comment #4)
...
> 
> commit a42ac5996cc55db9270a34349ccee04ac53997db
> Author: Øyvind Kolås <pippin@gimp.org>
> Date:   Tue Nov 21 19:57:23 2017 +0100
> 
>     gegl/operation: s/_context_get_source/_context_dup_object/
> 
...

This commit missed one _context_get_source occurrence here:

https://git.gnome.org/browse/gegl/tree/gegl/operation/gegl-operation-point-filter.c#n124

and building GEGL there is a deprecation warning

  CC       gegl-operation-point-filter.lo
gegl-operation-point-filter.c: In function ‘gegl_operation_filter_process’:
gegl-operation-point-filter.c:124:3: warning: ‘gegl_operation_context_get_source’ is deprecated [-Wdeprecated-declarations]
   input  = gegl_operation_context_get_source (context, "input");
   ^~~~~
Comment 6 Øyvind Kolås (pippin) 2017-11-26 11:48:06 UTC
commit d9248d1d7fafeb880c4fb08f4a6ba94fad458041
Author: Øyvind Kolås <pippin@gimp.org>
Date:   Sun Nov 26 12:42:53 2017 +0100

    gegl: one more s/_context_get_source/_context_dup_object/