I have come to the conclusion that menus are complicated. A menu will typically have around fifty items in it, along with some submenus. Each of these has their own objects and all have to be dynamically created and freed as needed. Rather a lot of scope for memory leaks, which can’t be tolerated in a menu system, imo.
So I’ve spent the day finding as many memory leaks as possible, what a chore! But it’s getting better and I’m driven by the knowledge that these menus will be some of the best available in any shell by the time I’m finished with them. Yay for SharpE!