Fix segfault and double free

- Segfault was from TGUI, still mysterious. Now we bind button callbacks
to specific functions (instead of using default handler) to go through a
different code path.
- Double free was because of delete &it. I think that the proper way to
dispose of an element is hud.remove(ptr).