The latest revision's fixup removes m_dbusNames
. The code now only keeps the m_displayChildren
hashmap, with ScreenBrightnessController
's display ID as key and display D-Bus object as value.
The same display will now first show up as display1
when first plugged in, then display2
when plugged in again after unplugging, and so on. But no reuse of previous indices, and it's extremely implausible that anyone would be able to hit the upper bound of size_t
to roll back over to 0.
So this seems like a good enough way to associate display IDs with objects while avoiding infinite growth. I'll resolve the thread after fixing the test and shutdown crash.