GNOME Bugzilla – Bug 663381
g_thread_new_internal() doesn't copy name
Last modified: 2011-11-15 03:20:38 UTC
Apart of all broken API on the master I noticed that g_thread_new_internal() doesn't copy the passed-in 'name' into the structure. There is no guarantee that the string will be a static string, neither a single note it's required. To be safe you should g_strdup it.
Have you seen a problem due to this ? The thread_name gets passed down into the kernel before g_thread_new returns, so there is really very little point in making a copy.
Nope, just by code reading, when seeing [1], which is suspicious enough to believe that the 'name' pointer can be freed immediately after finish of g_thread_new call, before kernel gets to its content. I do not see in the code where the 'name' gets passed anywhere after [1]. [1] http://git.gnome.org/browse/glib/tree/glib/gthread.c#n889
You may be right that the g_system_thread_set_name needs to be moved after the lock/unlock in the proxy function, at least.