Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransitUIWebViewContext must keep original delegate weak #35

Open
HBehrens opened this issue Apr 7, 2014 · 3 comments
Open

TransitUIWebViewContext must keep original delegate weak #35

HBehrens opened this issue Apr 7, 2014 · 3 comments

Comments

@HBehrens
Copy link
Member

HBehrens commented Apr 7, 2014

id<UIWebViewDelegate> _originalDelegate;

@mrcljx
Copy link
Member

mrcljx commented Apr 7, 2014

// ObjC novice speaking here

Are you sure about that? Strong seems fine to me because nothing else would be referencing it. Maybe the app forgot to set webView.delegate = nil which would release the TransitUIWebViewContext which would release the _originalDelegate then?

Or am I missing something?

@HBehrens
Copy link
Member Author

HBehrens commented Apr 7, 2014

before: webView held delegate weakly
after: transitContext holds delegate strong

In common scenarios, the delegate (e.g. a ViewController) holds the transitContext strong so a retain cycle occurs.

@mrcljx
Copy link
Member

mrcljx commented Apr 7, 2014

Hmm, okay. Based on the UIWebView.delegate documentation and the warning I would have guessed that WebView has a strong reference on the delegate (although the property is "assign").

Important: Before releasing an instance of UIWebView for which you have set a delegate, you must first set its delegate property to nil. This can be done, for example, in your dealloc method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants