[glib/task-strdup-avoidance: 1/3] task: Don't overwrite source names




commit b1d44b8b23318e5fcd8621985f315f88bfb93f81
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 27 21:32:46 2022 -0400

    task: Don't overwrite source names
    
    Only set a name in g_task_attach_source
    if the source does not already have one.

 gio/gtask.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/gtask.c b/gio/gtask.c
index 774cba793a..3bc6bf6f46 100644
--- a/gio/gtask.c
+++ b/gio/gtask.c
@@ -1661,7 +1661,7 @@ g_task_attach_source (GTask       *task,
   g_source_set_callback (source, callback,
                          g_object_ref (task), g_object_unref);
   g_source_set_priority (source, task->priority);
-  if (task->name != NULL)
+  if (task->name != NULL && g_source_get_name (source) == NULL)
     g_source_set_name (source, task->name);
 
   g_source_attach (source, task->context);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]