Hi,
I was looking at an old multithreaded program which is creating problem (core dump)!. The debugger tells the problem at vector.clear().
Code:
=>[1] __rwstd::__destroy<UCProfileData>(pointer = 0x1142994b8), line 177 in "memory"
[2] std::allocator_interface<std::allocator<UCProfileData>,UCProfileData>::destroy(this = 0xffffffff7fffad67, p = 0x1142994b8), line 513 in "memory"
[3] std::vector<UCProfileData,std::allocator<UCProfileData> >::__destroy(this = 0xffffffff7fffb208, start = 0x114299650, finish = 0x114299fe0), line 147 in "vector"
[4] std::vector<UCProfileData,std::allocator<UCProfileData> >::erase(this = 0xffffffff7fffb208, first = 0x1142979a0, last = 0x114299fe0), line 522 in "vector"
[5] std::vector<UCProfileData,std::allocator<UCProfileData> >::clear(this = 0xffffffff7fffb208), line 550 in "vector"
while looking more i found somewhere in code by commenting one assignment in vector program works OK. The assignment was in vector through an iterator also which is in a loop.
Code:
for (iter= (*it)->my_vector.begin(); iter!= (*it)->my_vector.end(); ++iter)
{
-- some code working on iterator and then
(*iter)->value=1;
}
iter is of same type as it.my_vector
Also, I observed one thing, where the vector.clear is there if i put a print to log then also it works ok.
Please help what is happening wrong here.