Improve menu and OSD callbacks handling.
With the previous handling, removing a callback would add it to the trash bin, so if it was added back immediately after, it would still be removed. Also, modifying the callback vectors could cause iterators to become invalid, causing a crash. Using a regular for loop with an index fixes the issue.