mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
gsignal: Document memory management best practices for signal handlers
It’s quite common to see naked g_signal_connect() calls without a paired g_signal_handler_disconnect(). This is commonly a bug which could lead to uses of the callback user data after it’s been freed. Document the best practices for avoiding this kind of bug by properly disconnecting all signal handlers. https://bugzilla.gnome.org/show_bug.cgi?id=741779
This commit is contained in:
@@ -465,6 +465,9 @@ void g_signal_chain_from_overridden_handler (gpointer instance,
|
||||
* Connects a #GCallback function to a signal for a particular object.
|
||||
*
|
||||
* The handler will be called before the default handler of the signal.
|
||||
*
|
||||
* See [memory management of signal handlers][signal-memory-management] for
|
||||
* details on how to handle the return value and memory management of @data.
|
||||
*
|
||||
* Returns: the handler id (always greater than 0 for successful connections)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user