Ghost instances of indicators (WPF/Tabs)

I’m adding buttons to the menu bar, using TabChangeHanlder. All works well but after a while, and somewhat unpredictably…I get duplicate WPF buttons that are triggered by tab switches.

I dispose of everything correctly, unsubbed from all event handlers. But it seems NT is creating multiple instances of my indicator that hang around in the background and these are calling AddItems() when switching tabs. And I don’t know why. It seems to happen after a period of inactivity and is related to the TabChangeHandler being called and adding buttons. Once these instances are around they hang around in the background messing around with the menu on tab switches.

Does anyone have any experience of these issues? I’m following an almost identical structure to what is common with adding buttons to the menu bar and handling tab switching. Similar to that in the Sample WPF modifications file. (in this sample sometimes I’ve seen that duplicate buttons)

I’ve spent hours and hours trying to fix this and just when I think it’s fixed, it comes back. Sometimes can be hours, sometimes days. I’ve written a function that loops through the items in the menu and finds things that were created by my indicator that include a ‘tag’ I set but this seems like a hack. Sometimes there’s like 100+ icons that have accumulated and I’d like to get to the bottom of the problem.