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

Static initialization of mongo::DBClientConnection

      Hello.
      I'm using static instance of a class like this one:
      class Storage {
      private:
      mongo::DBClientConnection _db;
      };

      At the beginning of my program execution I got an Segmentation fault exception in std::string::assign, raised from here:
      _writeConcern = WriteConcern::acknowledged; (dbclient.cpp:1460).

      As the order of initialization of global and static variables are undefined I imply that static instance of
      static const WriteConcern acknowledged;
      hadn't been initialized at this moment.
      I've changed this line to
      _writeConcern = WriteConcern();
      and it solved the problem for me.

      Compiler: g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1, --c++11=on

            Assignee:
            tyler@10gen.com Tyler Brock
            Reporter:
            arwer Artyom
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: