[gstreamermm] taglist - Glib::Value destructo assume they are always initialized
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] taglist - Glib::Value destructo assume they are always initialized
- Date: Thu, 10 Apr 2014 13:36:17 +0000 (UTC)
commit b0a34b05eb2b6aa39f804e23aa30a3d95888ce9f
Author: Tomasz Lakota <tomasz lakota flytronic pl>
Date: Thu Mar 27 21:23:02 2014 +0100
taglist - Glib::Value destructo assume they are always initialized
Conflicts:
gstreamer/gstreamermm/taglist.cc
gstreamer/gstreamermm/taglist.h
gstreamer/src/taglist.ccg | 13 ++++++++++---
gstreamer/src/taglist.hg | 5 +++++
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gstreamer/src/taglist.ccg b/gstreamer/src/taglist.ccg
index 90164c6..8c29f1d 100644
--- a/gstreamer/src/taglist.ccg
+++ b/gstreamer/src/taglist.ccg
@@ -164,8 +164,14 @@ bool TagList::get_value(Tag tag, Glib::ValueBase& dest) const
bool TagList::get_value(const Glib::ustring& tag, Glib::ValueBase& dest) const
{
- return gst_tag_list_copy_value(dest.gobj(), const_cast<GstTagList*>(gobj()),
- tag.c_str());
+ GValue gst_value = {0};
+ if(gst_tag_list_copy_value(&gst_value, const_cast<GstTagList*>(gobj()), tag.c_str()))
+ {
+ g_value_copy(&gst_value, dest.gobj());
+ g_value_unset(&gst_value);
+ return true;
+ }
+ return false;
}
bool TagList::get_value(Tag tag, guint index, Glib::ValueBase& value) const
@@ -178,9 +184,10 @@ bool TagList::get_value(const Glib::ustring& tag, guint index, Glib::ValueBase&
const GValue* gst_value =
gst_tag_list_get_value_index(const_cast<GstTagList*>(gobj()),
tag.c_str(), index);
+
if(gst_value)
{
- value.init(gst_value);
+ g_value_copy(gst_value, value.gobj());
return true;
}
diff --git a/gstreamer/src/taglist.hg b/gstreamer/src/taglist.hg
index 3b202a3..c8795f7 100644
--- a/gstreamer/src/taglist.hg
+++ b/gstreamer/src/taglist.hg
@@ -601,6 +601,7 @@ template<class DataType>
bool TagList::get(Tag tag, DataType& data) const
{
Glib::Value<DataType> value;
+ value.init(value.value_type());
const bool result = this->get_value(tag, value);
if(result)
@@ -613,6 +614,7 @@ template<class DataType>
bool TagList::get(const Glib::ustring& tag, DataType& data) const
{
Glib::Value<DataType> value;
+ value.init(value.value_type());
const bool result = this->get_value(tag, value);
if(result)
@@ -625,6 +627,7 @@ template<class DataType>
bool TagList::get(Tag tag, guint index, DataType& data) const
{
Glib::Value<DataType> value;
+ value.init(value.value_type());
bool result = this->get_value(tag, index, value);
if(result)
@@ -637,6 +640,7 @@ template<class DataType>
bool TagList::get(const Glib::ustring& tag, guint index, DataType& data) const
{
Glib::Value<DataType> value;
+ value.init(value.value_type());
bool result = this->get_value(tag, index, value);
if(result)
@@ -645,6 +649,7 @@ bool TagList::get(const Glib::ustring& tag, guint index, DataType& data) const
return result;
}
+
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
} //namespace Gst
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]