From c813b1c276b7982ba436f6ca9322b91f2160e9f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 6 Dec 2017 13:36:30 +0200 Subject: [PATCH] query: Add an empty structure in writable_structure() if there is none yet This is consistent with how it works for GstEvent already. --- gst/gstquery.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gst/gstquery.c b/gst/gstquery.c index 3a27a6a..dd4929b 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -731,10 +731,21 @@ gst_query_get_structure (GstQuery * query) GstStructure * gst_query_writable_structure (GstQuery * query) { + GstStructure *structure; + g_return_val_if_fail (GST_IS_QUERY (query), NULL); g_return_val_if_fail (gst_query_is_writable (query), NULL); - return GST_QUERY_STRUCTURE (query); + structure = GST_QUERY_STRUCTURE (query); + + if (structure == NULL) { + structure = + gst_structure_new_id_empty (gst_query_type_to_quark (GST_QUERY_TYPE + (query))); + gst_structure_set_parent_refcount (structure, &query->mini_object.refcount); + GST_QUERY_STRUCTURE (query) = structure; + } + return structure; } /** -- 2.7.4