summaryrefslogtreecommitdiff
path: root/RtAudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'RtAudio.cpp')
-rw-r--r--RtAudio.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index ab50cbb..4a3966b 100644
--- a/RtAudio.cpp
+++ b/RtAudio.cpp
@@ -3661,9 +3661,12 @@ unsigned int RtApiDs :: getDeviceCount( void )
}
// Clean out any devices that may have disappeared.
- std::vector< DsDevice > :: iterator it;
- for ( it=dsDevices.begin(); it < dsDevices.end(); it++ )
- if ( it->found == false ) dsDevices.erase( it );
+ std::vector< int > indices;
+ for ( unsigned int i=0; i<dsDevices.size(); i++ )
+ if ( dsDevices[i].found == false ) indices.push_back( i );
+ for ( unsigned int nErased=0, unsigned int i=0; i<indices.size(); i++, nErased++ ) {
+ dsDevices.erase( dsDevices.begin()-nErased );
+ }
return dsDevices.size();
}