[gst-debugger] refactor: fix some segfaults
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gst-debugger] refactor: fix some segfaults
- Date: Mon, 5 Oct 2015 10:13:52 +0000 (UTC)
commit 115ae7dcb3ac2b4fa3963e0e4513e1a059f293c6
Author: Marcin Kolny <marcin kolny gmail com>
Date: Mon Oct 5 11:49:05 2015 +0200
refactor: fix some segfaults
src/debugserver/gstdebugservermessage.c | 5 +++--
src/debugserver/gstdebugservertopology.c | 5 ++++-
src/gst-debugger/gvalue-converter/gvalue_flags.cpp | 13 +++++++++----
src/gst-debugger/modules/log_module.cpp | 1 -
4 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/debugserver/gstdebugservermessage.c b/src/debugserver/gstdebugservermessage.c
index 0503678..cacfec6 100644
--- a/src/debugserver/gstdebugservermessage.c
+++ b/src/debugserver/gstdebugservermessage.c
@@ -85,13 +85,14 @@ void gst_debugserver_message_send_message (GstDebugserverMessage * msg, GstDebug
{
GstDebugger__GStreamerData gst_data = GST_DEBUGGER__GSTREAMER_DATA__INIT;
GstDebugger__MessageInfo msg_info = GST_DEBUGGER__MESSAGE_INFO__INIT;
- gchar *structure_data = gst_structure_to_string (gst_message_get_structure (gst_msg));
+ const GstStructure *msg_structure = gst_message_get_structure (gst_msg);
+ gchar *structure_data = msg_structure != NULL ? gst_structure_to_string (msg_structure) : NULL;
msg_info.seqnum = gst_msg->seqnum;
msg_info.timestamp = gst_msg->timestamp;
msg_info.type = gst_msg->type;
msg_info.structure_data.data = structure_data;
- msg_info.structure_data.len = strlen (structure_data);
+ msg_info.structure_data.len = structure_data == NULL ? 0 : strlen (structure_data);
gst_data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_MESSAGE_INFO;
gst_data.message_info = &msg_info;
diff --git a/src/debugserver/gstdebugservertopology.c b/src/debugserver/gstdebugservertopology.c
index 0294e10..be7d51b 100644
--- a/src/debugserver/gstdebugservertopology.c
+++ b/src/debugserver/gstdebugservertopology.c
@@ -53,10 +53,13 @@ send_object (GstObject *object, GstDebugger__Action action, GstDebugserverTcp *
topology.action = action;
if (GST_IS_ELEMENT (object)) {
+ GstElementFactory *factory = gst_element_get_factory (GST_ELEMENT_CAST (object));
element_tp.type_name = (gchar*) g_type_name (G_OBJECT_TYPE (object));
element_tp.path = gst_utils_get_object_path (object);
element_tp.is_bin = GST_IS_BIN (object);
- element_tp.factory_name = gst_plugin_feature_get_name (gst_element_get_factory (GST_ELEMENT_CAST
(object)));
+ if (factory != NULL) {
+ element_tp.factory_name = gst_plugin_feature_get_name (gst_element_get_factory (GST_ELEMENT_CAST
(object)));
+ }
topology.element = &element_tp;
topology.topology_type_case = GST_DEBUGGER__TOPOLOGY_INFO__TOPOLOGY_TYPE_ELEMENT;
} else if (GST_IS_PAD (object)) {
diff --git a/src/gst-debugger/gvalue-converter/gvalue_flags.cpp
b/src/gst-debugger/gvalue-converter/gvalue_flags.cpp
index 56e19c9..6da7d7a 100644
--- a/src/gst-debugger/gvalue-converter/gvalue_flags.cpp
+++ b/src/gst-debugger/gvalue-converter/gvalue_flags.cpp
@@ -108,9 +108,14 @@ void GValueFlags::set_sensitive(bool sensitive)
{
for (auto widget : widgets)
{
- auto box = get_internal_box(widget);
- if (!box) continue;
- for (auto w : box->get_children())
- w->set_sensitive(sensitive);
+ if (dynamic_cast<Gtk::ScrolledWindow*>(widget))
+ {
+ auto box = get_internal_box(widget);
+ if (!box) continue;
+ for (auto w : box->get_children())
+ w->set_sensitive(sensitive);
+ }
+ else
+ dynamic_cast<Gtk::Label*>(widget)->set_sensitive(sensitive);
}
}
diff --git a/src/gst-debugger/modules/log_module.cpp b/src/gst-debugger/modules/log_module.cpp
index d86e91f..9957e89 100644
--- a/src/gst-debugger/modules/log_module.cpp
+++ b/src/gst-debugger/modules/log_module.cpp
@@ -93,7 +93,6 @@ void LogControlModule::set_controller(const std::shared_ptr<Controller> &control
for (auto value : type.get().get_values())
{
- puts (value.second.name.c_str());
log_levels_combobox->append(value.second.name);
}
if (!type.get().get_values().empty())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]