Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
Description
See this example below:
bsoncxx::document::view getfilter ()
{
bsoncxx::builder::basic::document filter{};
filter.append( bsoncxx::builder::basic::kvp("p_test", "abcabc") );
return filter.view();
}
main()
//the filter's construction contain " *_data " pointer. but this pointer's destination memory will free when getfilter() function returned.
so I got "EXC_Bad_ACCESS" error.
This bug occasional occur, I suppose it depends c++ recycling the memory zone with "_data" pointer.
Another source of evidence:
auto filter = th->getfilter();
auto cursor = result.find(filter);
when I run directly, it told me "EXC_Bad_ACCESS".
But when I run into debug mode and "STEP BY STEP" before that statements, it seems normally, and got a right result.
My program is single threaded.