summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-18 06:55:50 +0200
committerSven Gothel <[email protected]>2020-10-18 06:55:50 +0200
commit75b1bb70467e68ed4f98cf2d9f177b28cc868379 (patch)
treeb2886fff64857183ba3c4d253287756715e99b52 /src
parentf3e88a8c6c0a5b255c20e0913c2ef865a1204909 (diff)
DBTAdapter::removeStatusListener(const AdapterStatusListener * l): Use copy_store() on custom mutable operation
Also std::move(snapshot) back to cow_vector, as set_store is now a move operation.
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/DBTAdapter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp
index bed9f624..198dd8f2 100644
--- a/src/direct_bt/DBTAdapter.cpp
+++ b/src/direct_bt/DBTAdapter.cpp
@@ -387,7 +387,7 @@ bool DBTAdapter::removeStatusListener(const AdapterStatusListener * l) {
throw jau::IllegalArgumentException("DBTAdapterStatusListener ref is null", E_FILE_LINE);
}
const std::lock_guard<std::recursive_mutex> lock(statusListenerList.get_write_mutex());
- std::shared_ptr<std::vector<std::shared_ptr<AdapterStatusListener>>> snapshot = statusListenerList.get_snapshot();
+ std::shared_ptr<std::vector<std::shared_ptr<AdapterStatusListener>>> snapshot = statusListenerList.copy_store();
int count = 0;
for(auto it = snapshot->begin(); it != snapshot->end(); ) {
if ( **it == *l ) {
@@ -399,7 +399,7 @@ bool DBTAdapter::removeStatusListener(const AdapterStatusListener * l) {
}
}
if( 0 < count ) {
- statusListenerList.set_store(snapshot);
+ statusListenerList.set_store(std::move(snapshot));
return true;
}
return false;