Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B Bolts-ObjC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 34
    • Issues 34
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • BoltsFramework
  • Bolts-ObjC
  • Merge requests
  • !284

BFTask retain cycle

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Max requested to merge github/fork/sgl0v/retain_cycle into main Oct 19, 2016
  • Overview 6
  • Commits 1
  • Pipelines 0
  • Changes 1

There is a way to introduce retain cycle and get a BFTask object leaked. Just create a task that is never finished with result/error or cancelled. Here is the example:

[[self asyncTask] continueWithSuccessBlock:^id _Nullable(BFTask * _Nonnull t) {
    ...
}];

- (BFTask *)syncTask {
    BFTaskCompletionSource *taskSource = [BFTaskCompletionSource taskCompletionSource];
    return taskSource.task;
}

The BFTask object is captured in the executionBlock block of the continueWithExecutor:block:cancellationToken: method. screen shot 2016-10-13 at 15 24 47

I'd propose to get rid of self reference capturing and cancel the task on deallocation (if needed).

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/sgl0v/retain_cycle