mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
ges: Do not forget to update the count when updating already used name
That could still lead to naming conflicts
This commit is contained in:
parent
10c3e97f42
commit
be23365899
2 changed files with 18 additions and 6 deletions
|
@ -305,11 +305,12 @@ _set_name (GESTimelineElement * self, const gchar * wanted_name)
|
|||
if (tmpcount > count) {
|
||||
count = tmpcount + 1;
|
||||
GST_DEBUG_OBJECT (self, "Using same naming %s but updated count to %i",
|
||||
name, count);
|
||||
wanted_name, count);
|
||||
} else if (tmpcount < count) {
|
||||
name = g_strdup_printf ("%s%d", lowcase_type, count);
|
||||
GST_DEBUG_OBJECT (self, "Name %s already allocated, giving: %s instead",
|
||||
wanted_name, name);
|
||||
count++;
|
||||
GST_DEBUG_OBJECT (self, "Name %s already allocated, giving: %s instead"
|
||||
" New count is %i", wanted_name, name, count);
|
||||
} else {
|
||||
count++;
|
||||
GST_DEBUG_OBJECT (self, "Perfect name, just bumping object count");
|
||||
|
|
|
@ -708,7 +708,7 @@ GST_END_TEST;
|
|||
|
||||
GST_START_TEST (test_ges_timeline_element_name)
|
||||
{
|
||||
GESClip *clip, *clip1, *clip2, *clip3;
|
||||
GESClip *clip, *clip1, *clip2, *clip3, *clip4, *clip5;
|
||||
GESAsset *asset;
|
||||
GESTimeline *timeline;
|
||||
GESLayer *layer;
|
||||
|
@ -744,9 +744,18 @@ GST_START_TEST (test_ges_timeline_element_name)
|
|||
fail_unless_equals_string (GES_TIMELINE_ELEMENT_NAME (clip2), "testclip6");
|
||||
|
||||
clip3 = GES_CLIP (ges_test_clip_new ());
|
||||
ges_timeline_element_set_name (GES_TIMELINE_ELEMENT (clip3),
|
||||
fail_unless_equals_string (GES_TIMELINE_ELEMENT_NAME (clip3), "testclip7");
|
||||
ges_timeline_element_set_name (GES_TIMELINE_ELEMENT (clip3), "testclip5");
|
||||
fail_unless_equals_string (GES_TIMELINE_ELEMENT_NAME (clip3), "testclip8");
|
||||
|
||||
clip4 = GES_CLIP (ges_test_clip_new ());
|
||||
fail_unless_equals_string (GES_TIMELINE_ELEMENT_NAME (clip4), "testclip9");
|
||||
|
||||
|
||||
clip5 = GES_CLIP (ges_test_clip_new ());
|
||||
ges_timeline_element_set_name (GES_TIMELINE_ELEMENT (clip5),
|
||||
"Something I want!");
|
||||
fail_unless_equals_string (GES_TIMELINE_ELEMENT_NAME (clip3),
|
||||
fail_unless_equals_string (GES_TIMELINE_ELEMENT_NAME (clip5),
|
||||
"Something I want!");
|
||||
|
||||
gst_object_unref (asset);
|
||||
|
@ -754,6 +763,8 @@ GST_START_TEST (test_ges_timeline_element_name)
|
|||
gst_object_unref (clip1);
|
||||
gst_object_unref (clip2);
|
||||
gst_object_unref (clip3);
|
||||
gst_object_unref (clip4);
|
||||
gst_object_unref (clip5);
|
||||
gst_object_unref (timeline);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue