We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1448 - SDL_PushEvent does not copy event
Summary: SDL_PushEvent does not copy event
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-13 15:35 UTC by andre
Modified: 2013-03-01 01:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andre 2012-03-13 15:35:40 UTC
The docs for SDL_PushEvent state "The event is copied into the queue, and the caller may dispose of the memory pointed to after SDL_PushEvent() returns.".  This is not the case in the current HG codebase.  I am not sure if this is a documentation error, a non-implemented feature, or a bug.  The pointer for the event is copied, and the event itself is not copied.
Comment 1 john 2013-02-18 14:37:59 UTC
The event is copied by value. SDL_PushEvent calls SDL_PeepEvent, which calls SDL_AddEvent, which performs the by-value copy.
Comment 2 Sam Lantinga 2013-03-01 01:25:52 UTC
Note that if your event contains userdata pointers, the pointers are copied, not the memory they point to.  You need to manage those objects yourself and make sure you don't free them while the event is being delivered.