[CXX-665] segment fault with vector Created: 17/Sep/15 Updated: 11/Sep/19 Resolved: 18/Sep/15 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Better Wang | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | legacy-cxx | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
centos 5.5 |
||
| Description |
|
Hi
gdb debug info is :
anyone know this? the some code is fine with my mac. |
| Comments |
| Comment by Andrew Morrow (Inactive) [ 18/Sep/15 ] | |||||||
|
Hi better62932 - Your question is better suited to the mongodb-user mailing list: https://groups.google.com/forum/#!forum/mongodb-user I recommend you post your question there. I'm closing this ticket as there is no bug to be fixed in the driver, but please feel free to re-open it if you need additional help with the lifetime issues. | |||||||
| Comment by Better Wang [ 18/Sep/15 ] | |||||||
|
Hi | |||||||
| Comment by Andrew Morrow (Inactive) [ 17/Sep/15 ] | |||||||
|
The issue here is that the BSONObj returned from DBClientCursor::next() may by invalidated by subsequent calls to DBClientCursor::next or by destroying the cursor. If you want to capture a long lived copy of the returned BSONObj, you should write it as follows:
The call to getOwned will make a copy of the BSONObj that will not be invalidated by subsequent use of the cursor. |