From e5c4550ceea969a0a2ca5262e43f1ef1122a3ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 22 Jan 2023 09:08:28 +0200 Subject: Update GLib introspection data This is based on GLib ce876ab28bb81ac0b1c313223284de722d8208a1. --- gir/gio-2.0.c | 36 +++++++++++++++++++++-------- gir/glib-2.0.c | 72 +++++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 83 insertions(+), 25 deletions(-) diff --git a/gir/gio-2.0.c b/gir/gio-2.0.c index 10d7d78c..8b976743 100644 --- a/gir/gio-2.0.c +++ b/gir/gio-2.0.c @@ -10005,6 +10005,24 @@ * having come from the `_async()` wrapper * function (for "short-circuit" results, such as when passing * 0 to g_input_stream_read_async()). + * + * ## Thread-safety considerations + * + * Due to some infelicities in the API design, there is a + * thread-safety concern that users of GTask have to be aware of: + * + * If the `main` thread drops its last reference to the source object + * or the task data before the task is finalized, then the finalizers + * of these objects may be called on the worker thread. + * + * This is a problem if the finalizers use non-threadsafe API, and + * can lead to hard-to-debug crashes. Possible workarounds include: + * + * - Clear task data in a signal handler for `notify::completed` + * + * - Keep iterating a main context in the main thread and defer + * dropping the reference to the source object to that main + * context when the task is finalized */ @@ -20850,11 +20868,11 @@ * @uris: (element-type utf8): List of URIs * @launch_context: (nullable): a #GAppLaunchContext * @spawn_flags: #GSpawnFlags, used for each process - * @user_setup: (scope async) (nullable): a #GSpawnChildSetupFunc, used once + * @user_setup: (scope async) (nullable) (closure user_setup_data): a #GSpawnChildSetupFunc, used once * for each process. - * @user_setup_data: (closure user_setup) (nullable): User data for @user_setup - * @pid_callback: (scope call) (nullable): Callback for child processes - * @pid_callback_data: (closure pid_callback) (nullable): User data for @callback + * @user_setup_data: User data for @user_setup + * @pid_callback: (scope call) (nullable) (closure pid_callback_data): Callback for child processes + * @pid_callback_data: User data for @callback * @stdin_fd: file descriptor to use for child's stdin, or -1 * @stdout_fd: file descriptor to use for child's stdout, or -1 * @stderr_fd: file descriptor to use for child's stderr, or -1 @@ -22398,9 +22416,9 @@ * @flags: set of #GFileCopyFlags * @cancellable: (nullable): optional #GCancellable object, * %NULL to ignore - * @progress_callback: (nullable) (scope call): function to callback with + * @progress_callback: (nullable) (scope call) (closure progress_callback_data): function to callback with * progress information, or %NULL if progress information is not needed - * @progress_callback_data: (closure): user data to pass to @progress_callback + * @progress_callback_data: user data to pass to @progress_callback * @error: #GError to set on error, or %NULL * * Copies the file @source to the location specified by @destination. @@ -25082,9 +25100,9 @@ * @flags: set of #GFileCopyFlags * @cancellable: (nullable): optional #GCancellable object, * %NULL to ignore - * @progress_callback: (nullable) (scope call): #GFileProgressCallback + * @progress_callback: (nullable) (scope call) (closure progress_callback_data): #GFileProgressCallback * function for updates - * @progress_callback_data: (closure): gpointer to user data for + * @progress_callback_data: gpointer to user data for * the callback function * @error: #GError for returning error conditions, or %NULL * @@ -39100,7 +39118,7 @@ /** * g_subprocess_launcher_set_child_setup: (skip) * @self: a #GSubprocessLauncher - * @child_setup: a #GSpawnChildSetupFunc to use as the child setup function + * @child_setup: (closure user_data): a #GSpawnChildSetupFunc to use as the child setup function * @user_data: user data for @child_setup * @destroy_notify: a #GDestroyNotify for @user_data * diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c index 5aff475b..a4822562 100644 --- a/gir/glib-2.0.c +++ b/gir/glib-2.0.c @@ -682,7 +682,7 @@ /** * GHookCheckMarshaller: * @hook: a #GHook - * @user_data: user data + * @marshal_data: user data * * Defines the type of function used by g_hook_list_marshal_check(). * @@ -715,7 +715,7 @@ /** * GHookFindFunc: * @hook: a #GHook - * @user_data: user data passed to g_hook_find_func() + * @data: user data passed to g_hook_find_func() * * Defines the type of the function passed to g_hook_find(). * @@ -761,7 +761,7 @@ /** * GHookMarshaller: * @hook: a #GHook - * @user_data: user data + * @marshal_data: user data * * Defines the type of function used by g_hook_list_marshal(). */ @@ -1026,7 +1026,7 @@ * GIOFunc: * @source: the #GIOChannel event source * @condition: the condition which has been satisfied - * @user_data: user data set in g_io_add_watch() or g_io_add_watch_full() + * @data: user data set in g_io_add_watch() or g_io_add_watch_full() * * Specifies the type of function passed to g_io_add_watch() or * g_io_add_watch_full(), which is called when the requested condition @@ -1387,7 +1387,7 @@ /** * GNodeForeachFunc: * @node: a #GNode. - * @user_data: user data passed to g_node_children_foreach(). + * @data: user data passed to g_node_children_foreach(). * * Specifies the type of function passed to g_node_children_foreach(). * The function is called with each child node, together with the user @@ -1398,7 +1398,7 @@ /** * GNodeTraverseFunc: * @node: a #GNode. - * @user_data: user data passed to g_node_traverse(). + * @data: user data passed to g_node_traverse(). * * Specifies the type of function passed to g_node_traverse(). The * function is called with each of the nodes visited, together with the @@ -1858,7 +1858,7 @@ * GSequenceIterCompareFunc: * @a: a #GSequenceIter * @b: a #GSequenceIter - * @user_data: user data + * @data: user data * * A #GSequenceIterCompareFunc is a function used to compare iterators. * It must return zero if the iterators compare equal, a negative value @@ -2051,7 +2051,7 @@ /** * GThreadFunc: - * @user_data: data passed to the thread + * @data: data passed to the thread * * Specifies the type of the @func functions passed to g_thread_new() * or g_thread_try_new(). @@ -2224,7 +2224,7 @@ * GTraverseFunc: * @key: a key of a #GTree node * @value: the value corresponding to the key - * @user_data: user data passed to g_tree_traverse() + * @data: user data passed to g_tree_traverse() * * Specifies the type of function passed to g_tree_traverse(). It is * passed the key and value of each node, together with the @user_data @@ -9558,7 +9558,7 @@ * * This example defines a comparison function and search an element in a #GArray: * |[ - * static gint* + * static gint * cmpint (gconstpointer a, gconstpointer b) * { * const gint *_a = a; @@ -30558,9 +30558,11 @@ /** * g_set_print_handler: - * @func: the new print handler + * @func: (nullable): the new print handler or %NULL to + * reset to the default * - * Sets the print handler. + * Sets the print handler to @func, or resets it to the + * default GLib handler if %NULL. * * Any messages passed to g_print() will be output via * the new handler. The default handler simply outputs @@ -30568,15 +30570,24 @@ * you can redirect the output, to a GTK+ widget or a * log file for example. * - * Returns: the old print handler + * Since 2.76 this functions always returns a valid + * #GPrintFunc, and never returns %NULL. If no custom + * print handler was set, it will return the GLib + * default print handler and that can be re-used to + * decorate its output and/or to write to stderr + * in all platforms. Before GLib 2.76, this was %NULL. + * + * Returns: (not nullable): the old print handler */ /** * g_set_printerr_handler: - * @func: the new error message handler + * @func: (nullable): he new error message handler or %NULL + * to reset to the default * - * Sets the handler for printing error messages. + * Sets the handler for printing error messages to @func, + * or resets it to the default GLib handler if %NULL. * * Any messages passed to g_printerr() will be output via * the new handler. The default handler simply outputs the @@ -30584,7 +30595,14 @@ * redirect the output, to a GTK+ widget or a log file for * example. * - * Returns: the old error message handler + * Since 2.76 this functions always returns a valid + * #GPrintFunc, and never returns %NULL. If no custom error + * print handler was set, it will return the GLib default + * error print handler and that can be re-used to decorate + * its output and/or to write to stderr in all platforms. + * Before GLib 2.76, this was %NULL. + * + * Returns: (not nullable): the old error message handler */ @@ -33535,11 +33553,28 @@ * it's %FALSE, the caller gains ownership of the buffer and must * free it after use with g_free(). * + * Instead of passing %FALSE to this function, consider using + * g_string_free_and_steal(). + * * Returns: (nullable): the character data of @string * (i.e. %NULL if @free_segment is %TRUE) */ +/** + * g_string_free_and_steal: + * @string: (transfer full): a #GString + * + * Frees the memory allocated for the #GString. + * + * The caller gains ownership of the buffer and + * must free it after use with g_free(). + * + * Returns: (transfer full): the character data of @string + * Since: 2.76 + */ + + /** * g_string_free_to_bytes: * @string: (transfer full): a #GString @@ -35769,6 +35804,11 @@ * since their threads are never considered idle and returned to the * global pool. * + * Note that the threads used by exclusive threadpools will all inherit the + * scheduler settings of the current thread while the threads used by + * non-exclusive threadpools will inherit the scheduler settings from the + * first thread that created such a threadpool. + * * @error can be %NULL to ignore errors, or non-%NULL to report * errors. An error can only occur when @exclusive is set to %TRUE * and not all @max_threads threads could be created. -- cgit v1.2.1