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_ISystem.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_ISystem.h')
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 6825e8a0384..4c48473c7b8 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -319,9 +319,8 @@ public: /** * Retrieves events from the queue and send them to the event consumers. - * \return Indication of the presence of events. */ - virtual bool dispatchEvents() = 0; + virtual void dispatchEvents() = 0; /** * Adds the given event consumer to our list. |