Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

Modal view controller with UIWebView not deallocated upon dismissal #79

Closed
mwkirk opened this issue May 10, 2012 · 3 comments
Closed

Modal view controller with UIWebView not deallocated upon dismissal #79

mwkirk opened this issue May 10, 2012 · 3 comments

Comments

@mwkirk
Copy link

mwkirk commented May 10, 2012

First, great library, Zachary (and Alexsander); it's really a fantastic contribution and much appreciated.

Yesterday I discovered that the view controllers in a navigation stack presented modally were not being deallocated upon dismissal. After the requisite hair-pulling and self-accusations, it looks as though the culprit may instead be UIWebViews that use UIWebView+BlocksKit.

I've distilled the problem down to a very simple example (with no navigation controller, etc.) in this repo: https://github.com/mwkirk/BlocksKitWebViewTest

One view controller modally presents a second view controller with an embedded UIWebView with a didFinishLoadBock. The second view controller will not be deallocated when it is dismissed. You can see this when profiling with the Allocations Instrument. However, if the UIWebView's delegate is not set, deallocation works as expected (of course, the didFinishLoadBlock isn't called). See the comments in SecondViewController.m for more details. As far as I can tell, this happens on both the device and simulator from iOS4.2 through 5.1. The example uses v1.0.6a of the static lib on the downloads page.

I haven't had a chance to look at the underlying BlocksKit and A2DynamicDelegate code yet, but I thought you might have some insight. Meanwhile, I'm (sadly) ripping out BlocksKit from my project until I can get a handle on this.

With any luck, it's simply my own oversight or misuse of the library. (And, if so, I hope someone can set me straight!).

@zwaldowski
Copy link
Collaborator

That is quite the nasty retain cycle. It's already fixed in BlocksKit/A2DD
trunk. We'll be releasing them both as 2.0 version(s) shortly. Sorry for
any inconvenience, I hope you're able to use BlocksKit again soon enough.
Thanks so much! The documentation and sample code is greatly appreciated.

@mwkirk
Copy link
Author

mwkirk commented May 10, 2012

Excellent! I'm glad it was helpful, and thanks for acting on the bug report so quickly. I look forward to using BlocksKit again soon; things are certainly much less tidy and more complex without it. Any ETA on that release? It might help my planning a bit.

Best,
mark

@zwaldowski
Copy link
Collaborator

Fixed in BlocksKit 1.5. Sorry for the delay.

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

No branches or pull requests

2 participants