Skip to content
Snippets Groups Projects
Commit bbf8cca2 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

upnp: get callback once

avoids potential race condition

Change-Id: Iacb2225b4eedcaefd82a16ae40fffd72e5bb9af3
parent 3a14b373
Branches
No related tags found
No related merge requests found
...@@ -354,8 +354,8 @@ UPnPContext::reserveMapping(Mapping& requestedMap) ...@@ -354,8 +354,8 @@ UPnPContext::reserveMapping(Mapping& requestedMap)
mapRes->setNotifyCallback(requestedMap.getNotifyCallback()); mapRes->setNotifyCallback(requestedMap.getNotifyCallback());
mapRes->enableAutoUpdate(requestedMap.getAutoUpdate()); mapRes->enableAutoUpdate(requestedMap.getAutoUpdate());
// Notify the listener. // Notify the listener.
if (mapRes->getNotifyCallback()) if (auto cb = mapRes->getNotifyCallback())
mapRes->getNotifyCallback()(mapRes); cb(mapRes);
} }
updateMappingList(true); updateMappingList(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment