mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
Avoid SQLite connection object leaking
- W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.simplemobiletools.gallery.pro/databases/gallery.db' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed. Happens to me on Android 11 (Moto g 5G plus, with Google Photos disabled): - open Camera, then click on the small picture thumbnail from bottom-right corner which should open the Gallery app - in this scenario sometimes, the Simple Gallery was crashing and the above warning was seen in the logs... - no more crash after this patch: please review/test properly before incorporating!
This commit is contained in:
parent
7e83dc5b06
commit
dc72fc0de7
1 changed files with 5 additions and 0 deletions
|
@ -44,6 +44,11 @@ abstract class GalleryDatabase : RoomDatabase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun destroyInstance() {
|
fun destroyInstance() {
|
||||||
|
if (db != null) {
|
||||||
|
if(db!!.isOpen) {
|
||||||
|
db?.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
db = null
|
db = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue