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 784960 - caps: Using gst_caps_fixate with PyGobject lead to refcount issues
caps: Using gst_caps_fixate with PyGobject lead to refcount issues
Status: RESOLVED OBSOLETE
Product: pygobject
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2017-07-14 17:42 UTC by Thibault Saunier
Modified: 2018-01-10 20:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Add a test for GstCaps.fixate() (876 bytes, patch)
2017-07-14 17:42 UTC, Thibault Saunier
none Details | Review

Description Thibault Saunier 2017-07-14 17:42:41 UTC
And crash since:

  commit cce18426f756c0a17410020b0e5db06e7546257c
  Author: Tim-Philipp Müller <tim@centricular.com>
  Date:   Mon Jul 3 09:03:24 2017 +0100

      miniobject: make refcount tracing and debug logging reliable
      
      Tracing of the refcounts wasn't thread-safe, and log output of
      the refcount values before/after wasn't reliable.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=784383

It is annoted as input caps are (transfer full) and return caps are also
(transfer full). Basically in the case where make_writable simply return,
we gave our ref and got it back in the return value, otherwise the input
caps is unreffed (in make_writable) and we get a copy of the caps as a return
value, so to me the annotation look good but I am not 100% certain.

If you also think it is correct we should move that bug to PyGObject itself.

I also attach here a simple test to be applied to gst-python and showing the issue.
Comment 1 Thibault Saunier 2017-07-14 17:42:46 UTC
Created attachment 355618 [details] [review]
tests: Add a test for GstCaps.fixate()
Comment 2 Sebastian Dröge (slomo) 2017-07-14 18:27:40 UTC
The annotation is correct. gst_caps_truncate() is basically the same situation
Comment 3 Thibault Saunier 2017-07-14 18:36:43 UTC
What I thought, moving to PyGObject.
Comment 4 Sebastian Dröge (slomo) 2017-07-14 18:39:11 UTC
Is gst_caps_make_writable() equally broken? Maybe the problem is with things that are (transfer full) -> (transfer full).

Unrelated, I think (transfer move) which does not exist would be better here. Bindings will make all these functions as is rather useless: it will basically boil down to gst_caps_make_writable(gst_caps_ref(caps)), so always a copy is made.
Comment 5 Thibault Saunier 2017-07-14 18:58:59 UTC
make_writable is not introspectable, truncate() fails the same way.

I am not sure I get how movable would work in python?
Comment 6 Sebastian Dröge (slomo) 2017-07-14 20:52:41 UTC
I don't know, probably impossible. Why is make_writable() not introspectable? It's important for working with caps and other mini objects
Comment 7 Thibault Saunier 2017-07-15 02:27:04 UTC
(In reply to Sebastian Dröge (slomo) from comment #6)
> I don't know, probably impossible. Why is make_writable() not
> introspectable? It's important for working with caps and other mini objects

It is a macro.
Comment 8 Sebastian Dröge (slomo) 2017-07-17 13:04:50 UTC
Sure, gst_mini_object_make_writable() :)
Comment 9 GNOME Infrastructure Team 2018-01-10 20:59:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pygobject/issues/137.