[glib: 1/4] gerror: Document in the GError rules that stack allocation is bad




commit b2230cb3d13b38dd86e9101c092f39455af1b7bf
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Jan 13 13:28:12 2021 +0000

    gerror: Document in the GError rules that stack allocation is bad
    
    It means that extended error domains can’t be used.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/gerror.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/glib/gerror.c b/glib/gerror.c
index 18be9edec..4e0ee4c41 100644
--- a/glib/gerror.c
+++ b/glib/gerror.c
@@ -340,6 +340,8 @@
  * - A `GError*` must be initialized to %NULL before passing its address
  *   to a function that can report errors.
  *
+ * - #GError structs must not be stack-allocated.
+ *
  * - "Piling up" errors is always a bug. That is, if you assign a
  *   new #GError to a `GError*` that is non-%NULL, thus overwriting
  *   the previous error, it indicates that you should have aborted


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