Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: sql/connection.cc

Issue 1381563003: [sql] Check for open db before releasing cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/connection.cc
diff --git a/sql/connection.cc b/sql/connection.cc
index 662127c2796d67112ef9ccfff4d42d6a188f6b03..20f0f075cbafb0dd6c09f4afe5f4a021f5522b36 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -512,6 +512,8 @@ void Connection::Preload() {
// work. There could be two prepared statements, one for cache_size=1 one for
// cache_size=goal.
void Connection::ReleaseCacheMemoryIfNeeded(bool implicit_change_performed) {
+ DCHECK(is_open());
+
// If memory-mapping is not enabled, the page cache helps performance.
if (!mmap_enabled_)
return;
@@ -1364,8 +1366,10 @@ void Connection::DoRollback() {
RecordUpdateTime(delta);
RecordOneEvent(EVENT_ROLLBACK);
- // The cache may have been accumulating dirty pages for commit.
- ReleaseCacheMemoryIfNeeded(false);
+ // The cache may have been accumulating dirty pages for commit. Note that in
+ // some cases sql::Transaction can fire rollback after a database is closed.
+ if (is_open())
+ ReleaseCacheMemoryIfNeeded(false);
needs_rollback_ = false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698