mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
gstinfo: clean up function pointer names hashtable
And add strduped function pointer names to the global quark table, so that they don't get reported as lost by valgrind. This allows us to use GST_DEBUG when running tests under valgrind.
This commit is contained in:
parent
41f873fa0a
commit
dc5a62f702
3 changed files with 28 additions and 4 deletions
|
@ -1125,6 +1125,7 @@ gst_deinit (void)
|
|||
|
||||
_priv_gst_caps_features_cleanup ();
|
||||
_priv_gst_caps_cleanup ();
|
||||
_priv_gst_debug_cleanup ();
|
||||
|
||||
g_type_class_unref (g_type_class_peek (gst_object_get_type ()));
|
||||
g_type_class_unref (g_type_class_peek (gst_pad_get_type ()));
|
||||
|
|
|
@ -142,6 +142,7 @@ G_GNUC_INTERNAL void _priv_gst_date_time_initialize (void);
|
|||
G_GNUC_INTERNAL void _priv_gst_allocator_cleanup (void);
|
||||
G_GNUC_INTERNAL void _priv_gst_caps_features_cleanup (void);
|
||||
G_GNUC_INTERNAL void _priv_gst_caps_cleanup (void);
|
||||
G_GNUC_INTERNAL void _priv_gst_debug_cleanup (void);
|
||||
|
||||
/* called from gst_task_cleanup_all(). */
|
||||
G_GNUC_INTERNAL void _priv_gst_element_cleanup (void);
|
||||
|
|
|
@ -2060,7 +2060,7 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr func)
|
|||
* the name */
|
||||
#ifdef HAVE_DLADDR
|
||||
if (dladdr ((gpointer) func, &dl_info) && dl_info.dli_sname) {
|
||||
gchar *name = g_strdup (dl_info.dli_sname);
|
||||
const gchar *name = g_intern_string (dl_info.dli_sname);
|
||||
|
||||
_gst_debug_register_funcptr (func, name);
|
||||
return name;
|
||||
|
@ -2068,9 +2068,12 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr func)
|
|||
#endif
|
||||
{
|
||||
gchar *name = g_strdup_printf ("%p", (gpointer) func);
|
||||
const gchar *iname = g_intern_string (name);
|
||||
|
||||
_gst_debug_register_funcptr (func, name);
|
||||
return name;
|
||||
g_free (name);
|
||||
|
||||
_gst_debug_register_funcptr (func, iname);
|
||||
return iname;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2083,8 +2086,22 @@ _gst_debug_register_funcptr (GstDebugFuncPtr func, const gchar * ptrname)
|
|||
|
||||
if (!__gst_function_pointers)
|
||||
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
if (!g_hash_table_lookup (__gst_function_pointers, ptr))
|
||||
if (!g_hash_table_lookup (__gst_function_pointers, ptr)) {
|
||||
g_hash_table_insert (__gst_function_pointers, ptr, (gpointer) ptrname);
|
||||
}
|
||||
|
||||
g_mutex_unlock (&__dbg_functions_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
_priv_gst_debug_cleanup (void)
|
||||
{
|
||||
g_mutex_lock (&__dbg_functions_mutex);
|
||||
|
||||
if (__gst_function_pointers) {
|
||||
g_hash_table_unref (__gst_function_pointers);
|
||||
__gst_function_pointers = NULL;
|
||||
}
|
||||
|
||||
g_mutex_unlock (&__dbg_functions_mutex);
|
||||
}
|
||||
|
@ -2167,6 +2184,11 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr func)
|
|||
return "(NULL)";
|
||||
}
|
||||
|
||||
void
|
||||
_priv_gst_debug_cleanup (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gst_debug_log (GstDebugCategory * category, GstDebugLevel level,
|
||||
const gchar * file, const gchar * function, gint line,
|
||||
|
|
Loading…
Reference in a new issue