MongoDB C++ driver stable branch crashes in Qt application

I am developing a web application using Qt 5.7.0 and the MSVC 2015 64-bit compiler. I am using Qt Creator as IDE. I managed to build and link the mongoc, mongocxx and bsoncxx libraries with the system. These libraries have been built in release mode with the same compilers and runtimes as the Qt web application. I used version 1.9.0 of the C driver and version 3.1 of the stable C++ driver. The drivers were built according to the instructions and standard setup provided by MongoDB. I linked only the release versions of both drivers with my application.

In the debug build of my application everything works fine. However, in the release build of the web application, I manage to create an instance and connection pool in the main thread of the application but when I try to acquire a connection from this pool in a child thread, the system crashes. The exact location of the crash is indicated in the code samples below.

I am not sure if this is a bug in the driver or in my multithreaded code so I include the relevant snippets of code below. The MongoPool object is created in the main thread. The MongoConnector objects are created in the child threads when a new user request is received. Please note that I minimized the code as much as possible as requested in the comments. Any person who wishes to receive the complete application code, please contact me and I will be glad to provide it to you.

The error message and stack trace

The stack trace

main.cpp

#include "mongopool.h"

MongoPool *pool;

int main(int argc, char *argv[])
{
    QCoreApplication app(argc,argv);

    // Initialize MongoDB
    pool = new MongoPool();

    app.exec();
}

#include "mongoconnector.h"

extern MongoPool *pool;

MongoConnector::MongoConnector()
{
}

bool MongoConnector::storeDocument(QString dbName,
                                   QString collectionName,
                                   QString docID,
                                   QString doc)
{

    try {
        std::cout << "Creating database connection" << "\n";

        mongocxx::pool::entry client = pool->get_connection();
        if(!client)
        {
            std::cout << "No Connection!";
        }

        std::cout << "Obtaining database and collection" << "\n";

        // HERE THE CRASH HAPPENS!!!
        mongocxx::database dataDB = client->database(dbName.toLatin1().toStdString());
        mongocxx::collection dataCollection = dataDB[collectionName.toLatin1().toStdString()];
        // ....

    } catch (const std::exception& xcp) {
        std::cout << "connection failed: " << xcp.what() << "\n";
    }

    return true;
}

#include "mongopool.h"

// INCLUDE STATEMENTS ARE OMITTED FOR MONGOCXX AND BSONCXX

class MongoConnector
{
public:
    MongoConnector();

    bool storeDocument(QString dbName,
                       QString collectionName,
                       QString docID,
                       QString doc);
};

#include "mongopool.h"

MongoPool::MongoPool()
{
    using bsoncxx::builder::stream::document;

    auto uri = mongocxx::uri{mongocxx::uri::k_default_uri};
    configure(std::move(uri));

    try {
        mongocxx::pool::entry client = get_connection();

        auto admin = client->database("admin");

        document ismaster;
        ismaster << "isMaster" << 1;

        auto result = admin.run_command(ismaster.view());

    } catch (const std::exception& xcp) {
        std::cout << "connection failed: " << xcp.what() << "\n";
    }
}

void MongoPool::configure(mongocxx::uri uri) {
    class noop_logger : public mongocxx::logger {
    public:
        virtual void operator()(mongocxx::log_level, mongocxx::stdx::string_view,
                                mongocxx::stdx::string_view) noexcept {
        }
    };

    auto instance =
            mongocxx::stdx::make_unique<mongocxx::instance>(mongocxx::stdx::make_unique<noop_logger>());

    configure(std::move(instance),
              mongocxx::stdx::make_unique<mongocxx::pool>(std::move(uri)));
}

void MongoPool::configure(std::unique_ptr<mongocxx::instance> instance,
                               std::unique_ptr<mongocxx::pool> pool) {
    _instance = std::move(instance);
    _pool = std::move(pool);
}

mongocxx::pool::entry MongoPool::get_connection() {
    return _pool->acquire();
}

mongocxx::stdx::optional<mongocxx::pool::entry> MongoPool::try_get_connection() {
    return _pool->try_acquire();
}

// INCLUDE STATEMENTS ARE OMITTED FOR MONGOCXX AND BSONCXX

class MongoPool
{
public:
    MongoPool();

    void configure(mongocxx::uri uri);
    void configure(std::unique_ptr<mongocxx::instance> instance,
                   std::unique_ptr<mongocxx::pool> pool);
    mongocxx::pool::entry get_connection();
    mongocxx::stdx::optional<mongocxx::pool::entry> try_get_connection();

private:
    std::unique_ptr<mongocxx::instance> _instance;
    std::unique_ptr<mongocxx::pool> _pool;

};