mirror of
https://github.com/allankoechke/SQLiteCpp.git
synced 2026-12-05 17:09:20 +00:00
Add a Statement::Ptr move constructor to fix leak because of ref counter incremented on copy
This commit is contained in:
@@ -456,6 +456,18 @@ Statement::Ptr::Ptr(const Statement::Ptr& aPtr) :
|
||||
++(*mpRefCount);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
|
||||
Statement::Ptr::Ptr(Ptr&& aPtr) :
|
||||
mpSQLite(aPtr.mpSQLite),
|
||||
mpStmt(aPtr.mpStmt),
|
||||
mpRefCount(aPtr.mpRefCount)
|
||||
{
|
||||
aPtr.mpSQLite = NULL;
|
||||
aPtr.mpStmt = NULL;
|
||||
aPtr.mpRefCount = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Decrement the ref counter and finalize the sqlite3_stmt when it reaches 0
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user