[gst-debugger] common: fix serialization
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gst-debugger] common: fix serialization
- Date: Fri, 20 Oct 2017 17:40:03 +0000 (UTC)
commit 3b6c5d75bebe5d9aac2119ab475eda3ddf0b87ae
Author: Marcin Kolny <marcin kolny gmail com>
Date: Fri Oct 20 12:37:55 2017 +0100
common: fix serialization
GStreamer registers some types as fundamental (eg GstFraction)
but we cannot handle them as GLib fundamental types
src/common/serializer.c | 2 +-
.../gvalue-converter/gvalue_unknown.cpp | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/common/serializer.c b/src/common/serializer.c
index 06b2fd5..3793f26 100644
--- a/src/common/serializer.c
+++ b/src/common/serializer.c
@@ -13,7 +13,7 @@ gchar * g_value_serialize (GValue * value, GType * type, InternalGType * interna
{
GValue tmp = G_VALUE_INIT;
- if (G_TYPE_IS_FUNDAMENTAL (value->g_type)) {
+ if (G_TYPE_IS_FUNDAMENTAL (value->g_type) && value->g_type < G_TYPE_RESERVED_USER_FIRST) {
*type = value->g_type;
*internal_type = INTERNAL_GTYPE_FUNDAMENTAL;
return gst_value_serialize (value);
diff --git a/src/gst-debugger/gvalue-converter/gvalue_unknown.cpp
b/src/gst-debugger/gvalue-converter/gvalue_unknown.cpp
index d111ed1..896f1b2 100644
--- a/src/gst-debugger/gvalue-converter/gvalue_unknown.cpp
+++ b/src/gst-debugger/gvalue-converter/gvalue_unknown.cpp
@@ -17,8 +17,19 @@ GValueUnknown::GValueUnknown(GValue *gobj)
std::string GValueUnknown::to_string() const
{
- GstUnknownType *unknown_type = (GstUnknownType*)g_value_get_boxed(g_value);
- return _("unsupported type: ") + std::string(unknown_type->type_name);
+ std::string type_name;
+ if (!G_VALUE_HOLDS_BOXED(g_value))
+ {
+ type_name = "INVALID";
+ g_warning("GValueUnknown should hold boxed type!");
+ }
+ else
+ {
+ GstUnknownType *unknown_type = (GstUnknownType*)g_value_get_boxed(g_value);
+ type_name = unknown_type->type_name;
+ }
+
+ return _("unsupported type: ") + type_name;
}
Gtk::Widget* GValueUnknown::create_widget()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]