Permalink
Browse files

fixed a few bugs while testing iOS-Couchbase-Demo

  • Loading branch information...
1 parent 64fbf8e commit 1c726aa47e3cbec974655048b313a36993dddaf8 @explicitcall committed Jan 20, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 Source/TDReplicator.m
  2. +1 −1 Source/TDRouter.m
View
@@ -83,7 +83,7 @@ - (id) initWithDB: (TD_Database*)db
if (self) {
_thread = [NSThread currentThread];
_db = db;
- _remote = remote;
+ _remote = [remote copy];
_continuous = continuous;
Assert(push == self.isPush);
View
@@ -557,9 +557,9 @@ - (void) finished {
LogTo(TDRouter, @"%@", output);
}
OnFinishedBlock onFinished = _onFinished;
- [self stopNow];
if (onFinished)
onFinished();
+ [self stopNow];
}

1 comment on commit 1c726aa

snej commented on 1c726aa Jan 22, 2013

The change in TDReplicator is unnecessary. NSURL is immutable so -copy does the same thing as -retain, and there's already an implicit -retain call generated by ARC when assigning to _remote.

The change in TDRouter.m is wrong. The onFinished block needs to be called after the -stopNow call. Assigning _onFinished to a temporary variable keeps a reference to it, so it can still be called even though -stopNow released and zeroed the instance variable.

Please sign in to comment.