From 1447693d74144891974cd68b21742eb96a1e5001 Mon Sep 17 00:00:00 2001 From: Nikita Pettik <korablev@tarantool.org> Date: Fri, 14 Feb 2020 20:16:56 +0300 Subject: [PATCH] box/error: clarify purpose of reference counting in struct error --- src/lib/core/diag.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/core/diag.h b/src/lib/core/diag.h index 9c238f5a2b..7a5454d1c1 100644 --- a/src/lib/core/diag.h +++ b/src/lib/core/diag.h @@ -71,6 +71,15 @@ struct error { error_f raise; error_f log; const struct type_info *type; + /** + * Reference counting is basically required since + * instances of this structure are available in Lua + * as well (as cdata with overloaded fields and methods + * by the means of introspection). Thus, it may turn + * out that Lua's GC attempts at releasing object + * meanwhile it is still used in C internals or vice + * versa. For details see luaT_pusherror(). + */ int refs; /** * Errno at the moment of the error -- GitLab