auto *new_service = services->reload_service(service);
if (new_service != service) {
service->prepare_for_unload();
- services->remove_service(service);
+ services->replace_service(service, new_service);
delete service;
}
else {
records.erase(std::find(records.begin(), records.end(), svc));
}
+ void replace_service(service_record *orig, service_record *replacement)
+ {
+ auto i = std::find(records.begin(), records.end(), orig);
+ *i = replacement;
+ }
+
// Get the list of all loaded services.
const std::list<service_record *> &list_services() noexcept
{