From 523412edfbd60c8b064f2392c413d2916e2aa9b9 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 3 Nov 2015 16:03:00 -0800 Subject: [PATCH] Abort backup in progress if thread is told to shut down. --- controller/SqliteNetworkController.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controller/SqliteNetworkController.cpp b/controller/SqliteNetworkController.cpp index 60e5bf546..049db04ed 100644 --- a/controller/SqliteNetworkController.cpp +++ b/controller/SqliteNetworkController.cpp @@ -1029,6 +1029,12 @@ void SqliteNetworkController::threadMain() int rc = SQLITE_OK; for(;;) { + if (!_backupThreadRun) { + sqlite3_backup_finish(bak); + sqlite3_close(bakdb); + OSUtils::rm(backupPath); + return; + } _lock.lock(); rc = sqlite3_backup_step(bak,64); _lock.unlock();