0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

release ClientCursor in removeRange since sometimes the cursor itself is deleted SERVER-2319

This commit is contained in:
Eliot Horowitz 2011-01-02 20:28:09 -05:00
parent 6c1cdf7d2e
commit 025cf2313e

View File

@ -246,7 +246,7 @@ namespace mongo {
IndexDetails& i = nsd->idx( ii );
shared_ptr<Cursor> c( new BtreeCursor( nsd , ii , i , minClean , maxClean , maxInclusive, 1 ) );
scoped_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
auto_ptr<ClientCursor> cc( new ClientCursor( QueryOption_NoCursorTimeout , c , ns ) );
cc->setDoingDeletes( true );
while ( c->ok() ){
@ -267,6 +267,7 @@ namespace mongo {
if ( yield && ! cc->yieldSometimes() ){
// cursor got finished by someone else, so we're done
cc.release(); // if the collection/db is dropped, cc may be deleted
break;
}
}