Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.1
-
None
-
Mac OS X 10.5.6
-
Patch Available
Description
In lib/cpp/src/consurrency/test/ThreadFactoryTests.h the reapNThreads() function has this loop:
for (std::set<shared_ptr<Thread> >::const_iterator thread = threads.begin(); thread != threads.end(); thread++)
but erasing the element from the container invalidates all iteratots that point to that element, so this may result in undefined behavior.
I believe the equivalent is this:
while (!threads.empty())
although it really seems like you could just call threads.clear() as well and forgo the loop. But maybe there's some subtlety here that I'm missing.