Skip to content
Permalink
Browse files

db, bugfix: crash when releasing MongoDB connection before MongoColle…

…ction.
  • Loading branch information...
xicilion committed Sep 29, 2018
1 parent 17100aa commit e7dc3cf76739035f7d1e58b23f3786ffbc163427
Showing with 11 additions and 3 deletions.
  1. +11 −3 fibjs/include/MongoCollection.h
@@ -25,17 +25,25 @@ class MongoCollection : public MongoCollection_base {
public:
virtual bool enterTask(exlib::Task_base* current)
{
return m_db->enterTask(current);
obj_ptr<MongoDB> db(m_db);
if (!db)
return db->enterTask(current);

return true;
}

virtual void enter()
{
m_db->enter();
obj_ptr<MongoDB> db(m_db);
if (!db)
db->enter();
}

virtual void leave(exlib::Task_base* current = NULL)
{
m_db->leave(current);
obj_ptr<MongoDB> db(m_db);
if (!db)
db->leave(current);
}

public:

0 comments on commit e7dc3cf

Please sign in to comment.
You can’t perform that action at this time.