The code snippet is following:
ValueMapIter valueIter;
for (valueIter = activeValues->begin(); valueIter !=activeValues->end(); ++valueIter)
{
cout << "Before First" << endl;
cout << "sizeactivevalue:" << activeValues->size() << endl;
cout << "first:" << valueIter->first << "Second:" << valueIter->second << endl;
}
The PROGRAM output while running with gdb is: The program outputs
Before First
sizeactivevalue:10
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaaac8ad940 (LWP 8346)]
0x000000000043e732 in ValueManager::InsertModValue (this=0xd455c90, Id=4615, PId=7753, eId=1100000010570903, iId=2, inId=44301, pe=830795, t=25, bl=2, ste=3, sde=2)
at /home/pathtofile/valuemanager.cpp:304
304 cout << "first:" << valueIter->first << "Second:" << valueIter->second << endl;
How can it receive a segmentation fault, while I have a local copy of ValueMapIter and it ran on the code correctly previously.
The program is multithreaded; there is only one activeValues map. The snippet is inside the InsertModValues function. The size of the activeValue map is 10 then How can the iter not have a valid first element ?
Aucun commentaire:
Enregistrer un commentaire