added automatic cleanup link in hacking.md

This commit is contained in:
arujjval
2025-04-09 15:42:52 +00:00
committed by Georges Basile Stavracas Neto
parent 931254c2a4
commit 5461fa88b9
3 changed files with 18 additions and 0 deletions
+11
View File
@@ -132,6 +132,17 @@ foo_bar_do_somthing_sync (a, 1, object, data,
&error);
```
### Automatic Cleanup Variables
GLib provides macros like `g_auto`, `g_autoptr`, and `g_autofree` for automatic
cleanup of variables when they go out of scope.
Choose `g_auto` for non-pointer or stack-based types with custom cleanup,
`g_autoptr` for pointer types with type-specific cleanup functions, and
`g_autofree` for memory allocated with `g_malloc()` that should be freed using `g_free()`.
For more details, visit the official documentation [here](https://docs.gtk.org/glib/auto-cleanup.html).
# Contributing guidelines
See CONTRIBUTING.md file for the contribution guidelines, and the Code of Conduct