marioreggiori / objectdb

Persistent embedded document-oriented NoSQL database for Dart and Flutter.
https://pub.dev/packages/objectdb
MIT License
190 stars 21 forks source link

Fix to open() method #38

Closed ajplumlee33 closed 5 years ago

ajplumlee33 commented 5 years ago

Fix for bug similar to issue #20 - FileSystemException: Cannot rename file to '...test/test.db.bak', path = '...test/test.db' (OS Error: The process cannot access the file because it is being used by another process., errno = 32).

This fix makes the open(tidy: true) method more safe/flexible for other areas of the application besides just the main() method. For instance, this fix prevents the above exception if the application happened to invoke open(tidy: true) multiple times consecutively without invoking the close() method in between. There's also a chance that this bug could be the same as issue #26 as well.