Renderer improvements
This fixes some obvious problems in renderer memory leakage. #124
While looking at the code, I decided to disentangle it a bit in preparation for moving into Rust, which will bring easy and accurate caching as well as memory leak protection.
As a consequence, the button rendering procedure has become a little closer to being pure, but a bit more convoluted, and icon caching was lost. Both should be easily tractable when moved to Rust as part of #123.