From fd208f598ec6ee5707a8776c1a2cb94019a3e222 Mon Sep 17 00:00:00 2001 From: Pasin Suriyentrakorn Date: Mon, 28 Aug 2017 15:12:47 -0700 Subject: [PATCH] Fix race b/w resetting _bgMonitor to nil and using it * There is a race condition between resetting _bgMonitor to nil in -endBackground on the replicator thread and accessing _bgMonitor in -okToEndBackgrounding on the main thread. * The easiest way to fix this is to not resetting nil after stopping the bgMonitor given the fact that it could also be recreated again from the replicator thread in the -setupBackgrounding method. #1677 #CBSE-4145 --- Source/CBLRestReplicator+Backgrounding.m | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/CBLRestReplicator+Backgrounding.m b/Source/CBLRestReplicator+Backgrounding.m index 351fe2d27..d1c75c866 100644 --- a/Source/CBLRestReplicator+Backgrounding.m +++ b/Source/CBLRestReplicator+Backgrounding.m @@ -60,7 +60,6 @@ - (void) endBackgrounding { name: UIApplicationProtectedDataDidBecomeAvailable object: nil]; [_bgMonitor stop]; - _bgMonitor = nil; }