Well the device reference is kept until it disappears which will result in a call to OnMRRemoved() where we also remove it from the set. But changing it to a std::string is not a big deal.

The calls to OnMRAdded and OnMRRemoved usually come from the same thread (the one listening for SSDP and SCPD messages from other UPnP servers/clients/renderers). But in case of closing XBMC it will obviously come from another thread.