gmain: Add names to various GSources constructed in GLib

For the purposes of debugging, it is quite useful for every GSource to
have a name set. Ensure that any GSource we construct inside GLib has a
name set. For GSources which are then returned to the caller, this name
can then be overridden with something even more useful by the caller.

Since this data is only used for debugging, avoid doing any allocations
for it; just use static strings.

https://gitlab.gnome.org/GNOME/glib/issues/1175
This commit is contained in:
Philip Withnall
2016-06-16 18:31:42 -04:00
committed by Philip Withnall
parent cbfa776fc1
commit 208a6e815a
3 changed files with 74 additions and 0 deletions

View File

@@ -648,6 +648,8 @@ g_file_monitor_source_new (gpointer instance,
source = g_source_new (&source_funcs, sizeof (GFileMonitorSource));
fms = (GFileMonitorSource *) source;
g_source_set_name (source, "GFileMonitorSource");
g_mutex_init (&fms->lock);
fms->instance = instance;
fms->pending_changes = g_sequence_new (pending_change_free);