Bug 1091851 - Fix a race condition in Sqlite.jsm shutdown. r=mak
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Thu, 04 Jun 2015 15:09:37 +0200
changeset 278185 ca501a8670191f5466e8b9cbbe898d7df47e36db
parent 278184 1fba04d83168ca517ecaf5c295795fefa17c8cda
child 278186 86e252f5ad3e3416055ea1cb0318fe5d88ad4f01
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1091851
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1091851 - Fix a race condition in Sqlite.jsm shutdown. r=mak
toolkit/modules/Sqlite.jsm
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -437,28 +437,29 @@ ConnectionData.prototype = Object.freeze
     // This guards against operations performed between the call to this
     // function and asyncClose() finishing. See also bug 726990.
     this._open = false;
 
     // We must always close the connection at the Sqlite.jsm-level, not
     // necessarily at the mozStorage-level.
     let markAsClosed = () => {
       this._log.info("Closed");
-      this._dbConn = null;
       // Now that the connection is closed, no need to keep
       // a blocker for Barriers.connections.
       Barriers.connections.client.removeBlocker(this._deferredClose.promise);
       this._deferredClose.resolve();
     }
     if (wrappedConnections.has(this._identifier)) {
       wrappedConnections.delete(this._identifier);
+      this._dbConn = null;
       markAsClosed();
     } else {
       this._log.debug("Calling asyncClose().");
       this._dbConn.asyncClose(markAsClosed);
+      this._dbConn = null;
     }
     return this._deferredClose.promise;
   },
 
   executeCached: function (sql, params=null, onRow=null) {
     this.ensureOpen();
 
     if (!sql) {