Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-665

segment fault with vector

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • centos 5.5
      boost1.55
      gcc4.8.2
      mongo-cxx-driver(legacy)

    Description

      Hi
      First,I introduce the installtion of mongo-cxx.My centos has gcc4.8.2 and gcc4.4.6, but I install the boost1.55 and mongo-cxx with gcc4.8.2. And it's fine.
      I have a function to get query results and push them into a vector(vec). But when I get the data from the vec, segment fault occurs. code is :

              cursor = conn->query(dbco , obj);
      	vector<BSONObj> vObj;
      	while(cursor->more()){
      		vObj.push_back(cursor->next());
      	}
              BSONObj temp = vObj[0];// vObj.size()>0
              cout << temp.objsize()<<endl;
      

      gdb debug info is :

      (gdb) bt
      #0  0x00007ffff6432e36 in ?? ()
      #1  0x000000000040b460 in mongo::ConstDataView const& mongo::ConstDataView::readNative<int>(int*, unsigned long) const ()
      #2  0x000000000040a491 in int mongo::ConstDataView::readNative<int>(unsigned long) const ()
      #3  0x0000000000409627 in int mongo::ConstDataView::readLE<int>(unsigned long) const ()
      #4  0x0000000000408d3d in mongo::BSONObj::objsize() const ()
      

      anyone know this?

      the some code is fine with my mac.

      Attachments

        Activity

          People

            Unassigned Unassigned
            better62932 Better Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: