From 04dfca958a9f5bfa2760a220e33e0ce97f94a334 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 5 Nov 2023 21:25:43 -0800
Subject: [PATCH] Added a note to events indicating that memory is owned by SDL
---
include/SDL3/SDL_events.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h
index 6aa8b9aeb510..760c6ca75b76 100644
--- a/include/SDL3/SDL_events.h
+++ b/include/SDL3/SDL_events.h
@@ -259,6 +259,9 @@ typedef struct SDL_KeyboardEvent
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE 64
/**
* \brief Keyboard text editing event structure (event.edit.*)
+ *
+ * The `text` is owned by SDL and should be copied if the application
+ * wants to hold onto it beyond the scope of handling this event.
*/
typedef struct SDL_TextEditingEvent
{
@@ -273,6 +276,9 @@ typedef struct SDL_TextEditingEvent
#define SDL_TEXTINPUTEVENT_TEXT_SIZE 64
/**
* \brief Keyboard text input event structure (event.text.*)
+ *
+ * The `text` is owned by SDL and should be copied if the application
+ * wants to hold onto it beyond the scope of handling this event.
*/
typedef struct SDL_TextInputEvent
{
@@ -508,6 +514,9 @@ typedef struct SDL_TouchFingerEvent
#define SDL_DROPEVENT_DATA_SIZE 64
/**
* \brief An event used to drop text or request a file open by the system (event.drop.*)
+ *
+ * The `data` is owned by SDL and should be copied if the application
+ * wants to hold onto it beyond the scope of handling this event.
*/
typedef struct SDL_DropEvent
{
@@ -580,6 +589,9 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg;
* \brief A video driver dependent system event (event.syswm.*)
* This event is disabled by default, you can enable it with SDL_SetEventEnabled()
*
+ * The `msg` is owned by SDL and should be copied if the application
+ * wants to hold onto it beyond the scope of handling this event.
+ *
* \note If you want to use this event, you should include SDL_syswm.h.
*/
typedef struct SDL_SysWMEvent