Reworked forms code, add assertion checks, demo app mainwindow handling

- Rework forms code to allow dynamically allocated memory to be freed
- Add initialized-to-zero checks for structures with free functions;
- Reworked gui_demo application main window creation / memory free