Fix race in shutdown: context should be shut down in case of error.

This commit is contained in:
Andrey Smirnov
2014-03-04 18:39:43 +04:00
parent 1902f38e6b
commit 410caa6141
2 changed files with 13 additions and 3 deletions
+9 -3
View File
@@ -139,7 +139,13 @@ func ShutdownContext() {
context.fileMemProfile = nil
}
}
context.database.Close()
context.downloader.Shutdown()
context.progress.Shutdown()
if context.database != nil {
context.database.Close()
}
if context.downloader != nil {
context.downloader.Shutdown()
}
if context.progress != nil {
context.progress.Shutdown()
}
}