diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2015-12-27 20:07:38 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2015-12-27 20:08:44 +0300 |
commit | 3e35e32e9de35f5e5dc7a6b4a6441d80aa44b350 (patch) | |
tree | d47130c52cb3e961905dab6ee1dbaec1529ff946 /intern/ghost/GHOST_C-api.h | |
parent | a36b5228694731483ea201668bf0775b6deb1973 (diff) |
Fix memory leak in GHOST Event Manager.
The events are allocated on the heap, then pushed on a stack. Before
being processed, they are popped from the stack, and deleted after
processing is done. When the manager is destroyed (e.g. application
closing), any remaining event in the stack is detroyed.
Issue is that when the "application closing" event is processed, it is
never freed, because the manager gets destroyed before the call to
`delete` is made and the event is not on the stack anymore.
Now events are left on the stack while they are processed, and only
popped and deleted after processing is done.
As a slight bonus refactor: use void as return type for dispatch events
functions, as no caller is checking the return value, and it is not
clear what it means (suggested by the reviewer).
Reviewers: brecht
Differential Revision: https://developer.blender.org/D1695
Diffstat (limited to 'intern/ghost/GHOST_C-api.h')
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index ff0dc575005..f1484a298d3 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -263,9 +263,8 @@ extern int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent /** * Retrieves events from the queue and send them to the event consumers. * \param systemhandle The handle to the system - * \return Indication of the presence of events. */ -extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle); +extern void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle); /** * Adds the given event consumer to our list. |