[GH-ISSUE #522] authorizeURLHandler is not weak, prevents view controller from being deallocated #344

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

Originally created by @miktav on GitHub (Mar 8, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/522

Once I set OAuth2Swift authorizeURLHandler to my view controller, my view controller is never getting deallocated.

I believe this is happening because authorizeURLHandler is not declared as weak:

open var authorizeURLHandler: OAuthSwiftURLHandlerType

My view controller's deinit is never called.

Originally created by @miktav on GitHub (Mar 8, 2019). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/522 Once I set OAuth2Swift authorizeURLHandler to my view controller, my view controller is never getting deallocated. I believe this is happening because authorizeURLHandler is not declared as weak: open var authorizeURLHandler: OAuthSwiftURLHandlerType My view controller's deinit is never called.
kerem closed this issue 2026-03-03 16:47:55 +03:00
Author
Owner

@phimage commented on GitHub (Jun 10, 2019):

possible workaround
oauthswift object as week in controller
or restore default authorizeURLHandler

<!-- gh-comment-id:500299445 --> @phimage commented on GitHub (Jun 10, 2019): possible workaround oauthswift object as week in controller or restore default authorizeURLHandler
Author
Owner

@phimage commented on GitHub (Jun 10, 2019):

I will propose a new solution in next version with explicit code to make weak
Because make weak for everybody could create some bugs like #526

<!-- gh-comment-id:500570595 --> @phimage commented on GitHub (Jun 10, 2019): I will propose a new solution in next version with explicit code to make weak Because make weak for everybody could create some bugs like #526
Author
Owner

@phimage commented on GitHub (Jun 10, 2019):

The solution to make weak by code

oauthswift.authorizeURLHandler = YourVariable.weak()

This will a proxy with weak reference

<!-- gh-comment-id:500573487 --> @phimage commented on GitHub (Jun 10, 2019): The solution to make weak by code ```swift oauthswift.authorizeURLHandler = YourVariable.weak() ``` This will a proxy with weak reference
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#344
No description provided.