layer: fix ownership when failing to add clip
authorHenry Wilkes <hwilkes@igalia.com>
Tue, 18 Feb 2020 09:17:09 +0000 (09:17 +0000)
committerThibault Saunier <tsaunier@igalia.com>
Thu, 5 Mar 2020 20:04:51 +0000 (17:04 -0300)
commit1332ed674a95c495f9790def8c54e951fb53b97e
treec5849b435687ee1ae8933eedcd53da524f2863a7
parenta03afa54768b87c7196ff58adb77a6c284a75783
layer: fix ownership when failing to add clip

If a clip is already part of a layer, then adding it to another layer
should fail. Previously, in this case, `ges_layer_add_clip` was adding a
reference to the clip instead, without subsequently giving up ownership.
This meant that the clip would be left with an unowned reference.
This has now been corrected by also calling `unref` after the
`ref_sink`.

Note that, since `clip` is already part of `current_layer`, it should
already be non-floating, so the `ref_sink`-`unref` should do nothing
overall. But we keep both to make the ownership (transfer floating/none)
explicit.
ges/ges-layer.c