diff options
-rw-r--r-- | common/storage_lmdb.cpp | 1 | ||||
-rw-r--r-- | tests/storagetest.cpp | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index e3685a5..cb7bca4 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -563,6 +563,7 @@ DataStore::Transaction::Transaction(Transaction &&other) : d(nullptr) | |||
563 | DataStore::Transaction &DataStore::Transaction::operator=(DataStore::Transaction &&other) | 563 | DataStore::Transaction &DataStore::Transaction::operator=(DataStore::Transaction &&other) |
564 | { | 564 | { |
565 | if (&other != this) { | 565 | if (&other != this) { |
566 | abort(); | ||
566 | delete d; | 567 | delete d; |
567 | d = other.d; | 568 | d = other.d; |
568 | other.d = nullptr; | 569 | other.d = nullptr; |
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index 7202628..dfb91ec 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp | |||
@@ -487,6 +487,24 @@ private slots: | |||
487 | } | 487 | } |
488 | } | 488 | } |
489 | 489 | ||
490 | void testCopyTransaction() | ||
491 | { | ||
492 | Sink::Storage::DataStore store(testDataPath, dbName, Sink::Storage::DataStore::ReadWrite); | ||
493 | { | ||
494 | auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadWrite); | ||
495 | transaction.openDatabase("a", nullptr, false); | ||
496 | transaction.openDatabase("b", nullptr, false); | ||
497 | transaction.openDatabase("c", nullptr, false); | ||
498 | transaction.commit(); | ||
499 | } | ||
500 | auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); | ||
501 | for (int i = 0; i < 1000; i++) { | ||
502 | transaction.openDatabase("a", nullptr, false); | ||
503 | transaction.openDatabase("b", nullptr, false); | ||
504 | transaction.openDatabase("c", nullptr, false); | ||
505 | transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); | ||
506 | } | ||
507 | } | ||
490 | }; | 508 | }; |
491 | 509 | ||
492 | QTEST_MAIN(StorageTest) | 510 | QTEST_MAIN(StorageTest) |