[GH-ISSUE #451] possible retention loop with SafariURLHandler #295

Closed
opened 2026-03-03 16:47:28 +03:00 by kerem · 3 comments
Owner

Originally created by @shaibt on GitHub (Apr 11, 2018).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/451

Description:

Hi,
Seems that these 2 classes hold strong references to each other:

  • SafariURLHandler holds a strong reference to OAuthSwift through its oauthSwift property
  • OAuthSwift holds a strong reference to SafariURLHandler through its authorizeURLHandler property

Is this by design? when using the SafariURLHandler as shown in the docs I get a retention cycle and neither of the two get released as a result.

OAuth Version:

  • Version 2

OS (Please fill the version) :

  • iOS :

Installation method:

  • CocoaPods

Library version:

  • v1.2 (Swift 4.0)

Xcode version:

  • 9.3 (Swift 4.1)
Originally created by @shaibt on GitHub (Apr 11, 2018). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/451 ### Description: Hi, Seems that these 2 classes hold strong references to each other: - `SafariURLHandler` holds a strong reference to `OAuthSwift` through its `oauthSwift` property - `OAuthSwift` holds a strong reference to `SafariURLHandler` through its `authorizeURLHandler` property Is this by design? when using the `SafariURLHandler` as shown in the docs I get a retention cycle and neither of the two get released as a result. ### OAuth Version: - [x] Version 2 ### OS (Please fill the version) : - [x] iOS : ### Installation method: - [x] CocoaPods ### Library version: - [x] v1.2 (Swift 4.0) ### Xcode version: - [x] 9.3 (Swift 4.1)
kerem closed this issue 2026-03-03 16:47:29 +03:00
Author
Owner

@phimage commented on GitHub (Apr 12, 2018):

by design...
But yes! we need a weak reference in SafariURLHandler to break the cycle

You could PR if you want


https://github.com/krzysztofzablocki/LifetimeTracker

<!-- gh-comment-id:380705271 --> @phimage commented on GitHub (Apr 12, 2018): by design... But yes! we need a weak reference in SafariURLHandler to break the cycle You could PR if you want --- https://github.com/krzysztofzablocki/LifetimeTracker
Author
Owner

@shaibt commented on GitHub (Apr 12, 2018):

Done.
See PR: https://github.com/OAuthSwift/OAuthSwift/pull/452

<!-- gh-comment-id:380737431 --> @shaibt commented on GitHub (Apr 12, 2018): Done. See PR: https://github.com/OAuthSwift/OAuthSwift/pull/452
Author
Owner

@phimage commented on GitHub (Apr 12, 2018):

merged thanks you!

ps: next time you can put Fix #451 in your commit message to auto-close the issue

<!-- gh-comment-id:380738694 --> @phimage commented on GitHub (Apr 12, 2018): merged thanks you! ps: next time you can put Fix #451 in your commit message to auto-close the issue
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#295
No description provided.