From 7bf138da412bbe066fbdab8af5bb3d9be6d361b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Rodr=C3=ADguez?= Date: Tue, 2 Apr 2019 09:46:39 +0200 Subject: [PATCH] Close SQLite connection on termination. --- robovm/src/playn/robovm/RoboPlatform.java | 1 + robovm/src/playn/robovm/RoboStorage.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/robovm/src/playn/robovm/RoboPlatform.java b/robovm/src/playn/robovm/RoboPlatform.java index 78498188..f78f5af0 100644 --- a/robovm/src/playn/robovm/RoboPlatform.java +++ b/robovm/src/playn/robovm/RoboPlatform.java @@ -188,6 +188,7 @@ void didEnterBackground () { void willTerminate () { pool.shutdown(); + storage.close(); // let the app know that we're terminating dispatchEvent(lifecycle, Lifecycle.EXIT); } diff --git a/robovm/src/playn/robovm/RoboStorage.java b/robovm/src/playn/robovm/RoboStorage.java index 23ce96e7..4be64cb2 100644 --- a/robovm/src/playn/robovm/RoboStorage.java +++ b/robovm/src/playn/robovm/RoboStorage.java @@ -155,4 +155,12 @@ public Batch startBatch() { // SQL commands are already pretty fast, so it might not be necessary return new BatchImpl(this); } + + void close() { + try { + conn.close(); + } catch (SQLException sqe) { + // Not much to do here + } + } }