1010 * - The function pointers and UserData pointer are copied when the hook is
1111 * registered with the config builder
1212 * - UserData lifetime must extend for the entire lifetime of the SDK client
13- * - All context parameters passed to callbacks are temporary - valid only
14- * during the callback execution
13+ *
14+ * WARNING: All pointers passed to callbacks by the SDK (series_context, data,
15+ * detail, etc.) are owned by the SDK and may be freed after the callback
16+ * returns. You MUST NOT retain, cache, or store these pointers, or any
17+ * references to data within them, beyond the scope of the callback invocation.
18+ * Any data needed outside the duration of a callback must be copied during the
19+ * callback. Accessing a stored pointer or reference after the callback has
20+ * returned results in undefined behavior.
21+ *
1522 * - EvaluationSeriesData returned from callbacks transfers ownership to the SDK
1623 */
1724// NOLINTBEGIN(modernize-use-using)
@@ -49,7 +56,8 @@ typedef struct p_LDServerSDKTrackSeriesContext* LDServerSDKTrackSeriesContext;
4956 *
5057 * LIFETIME:
5158 * - series_context: Valid only during callback execution - do not store
52- * - data: Ownership transfers to SDK
59+ * - data: Valid only during callback execution - do not store. Ownership of
60+ * the returned value transfers to the SDK.
5361 * - user_data: Managed by caller - must remain valid for SDK lifetime
5462 */
5563typedef LDServerSDKEvaluationSeriesData (* LDServerSDKHook_BeforeEvaluation )(
@@ -77,10 +85,11 @@ typedef LDServerSDKEvaluationSeriesData (*LDServerSDKHook_BeforeEvaluation)(
7785 * If NULL is returned, an empty data object will be created.
7886 *
7987 * LIFETIME:
80- * - series_context: Valid only during callback execution
81- * - data: Ownership transfers to SDK
82- * - detail: Valid only during callback execution
83- * - user_data: Managed by caller
88+ * - series_context: Valid only during callback execution - do not store
89+ * - data: Valid only during callback execution - do not store. Ownership of
90+ * the returned value transfers to the SDK.
91+ * - detail: Valid only during callback execution - do not store
92+ * - user_data: Managed by caller - must remain valid for SDK lifetime
8493 */
8594typedef LDServerSDKEvaluationSeriesData (* LDServerSDKHook_AfterEvaluation )(
8695 LDServerSDKEvaluationSeriesContext series_context ,
@@ -102,8 +111,8 @@ typedef LDServerSDKEvaluationSeriesData (*LDServerSDKHook_AfterEvaluation)(
102111 * RETURNS: void (no data is passed between track stages)
103112 *
104113 * LIFETIME:
105- * - series_context: Valid only during callback execution
106- * - user_data: Managed by caller
114+ * - series_context: Valid only during callback execution - do not store
115+ * - user_data: Managed by caller - must remain valid for SDK lifetime
107116 */
108117typedef void (* LDServerSDKHook_AfterTrack )(LDServerSDKTrackSeriesContext series_context ,
109118 void * user_data );
0 commit comments