Blender Git Loki
Git Commits -> Revision 3e35e32
Revision 3e35e32 by Kévin Dietrich (master) December 27, 2015, 17:08 (GMT) |
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 |
Commit Details:
Full Hash: 3e35e32e9de35f5e5dc7a6b4a6441d80aa44b350
Parent Commit: a36b522
Lines Changed: +29, -87
7 Modified Paths:
/intern/ghost/GHOST_C-api.h (+1, -2) (Diff)
/intern/ghost/GHOST_ISystem.h (+1, -2) (Diff)
/intern/ghost/intern/GHOST_C-api.cpp (+2, -2) (Diff)
/intern/ghost/intern/GHOST_EventManager.cpp (+18, -54) (Diff)
/intern/ghost/intern/GHOST_EventManager.h (+3, -19) (Diff)
/intern/ghost/intern/GHOST_System.cpp (+3, -6) (Diff)
/intern/ghost/intern/GHOST_System.h (+1, -2) (Diff)
/intern/ghost/GHOST_ISystem.h (+1, -2) (Diff)
/intern/ghost/intern/GHOST_C-api.cpp (+2, -2) (Diff)
/intern/ghost/intern/GHOST_EventManager.cpp (+18, -54) (Diff)
/intern/ghost/intern/GHOST_EventManager.h (+3, -19) (Diff)
/intern/ghost/intern/GHOST_System.cpp (+3, -6) (Diff)
/intern/ghost/intern/GHOST_System.h (+1, -2) (Diff)