DZNWebViewController icon indicating copy to clipboard operation
DZNWebViewController copied to clipboard

Dismissing during page load causes KVO crash

Open bgerstle opened this issue 8 years ago • 10 comments

Steps to reproduce

Somewhat intermittent, but:

  1. Present DZNWebViewController modally within a navigation controller
  2. Before its URL is loaded, press "Done"

Expected results

View controller is dismissed

Actual results

Crash due to premature destruction of object with key-value observers still attached:

Fatal Exception: NSInternalInconsistencyException An instance 0x16611fe0 of class UINavigationBar was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x16617a60> ( <NSKeyValueObservance 0x17935770: Observer: 0x165f1480, Key path: hidden, Options: <New: YES, Old: NO, Prior: NO> Context: 0x172068, Property: 0x165f93c0> <NSKeyValueObservance 0x17937b30: Observer: 0x165f1480, Key path: center, Options: <New: YES, Old: NO, Prior: NO> Context: 0x172068, Property: 0x17937b60> <NSKeyValueObservance 0x16617a10: Observer: 0x165f1480, Key path: alpha, Options: <New: YES, Old: NO, Prior: NO> Context: 0x172068, Property: 0x16617a40> )

All the observers are instances of DZNWebViewController.

bgerstle avatar May 30 '16 20:05 bgerstle

Have you found solution? Actually i have got this crash once and i am not able to reproduce this. Are you able to reproduce this now?

sahana-kini avatar Jun 06 '16 07:06 sahana-kini

Sorry, haven't taken time to investigate.

On Mon, Jun 6, 2016 at 3:03 AM Sahana Kini [email protected] wrote:

Have you found solution?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dzenbot/DZNWebViewController/issues/50#issuecomment-223882633, or mute the thread https://github.com/notifications/unsubscribe/AAbHOXx-KFfUKGTtKigvdePqbUhBXfaJks5qI8YkgaJpZM4IqAlR .

bgerstle avatar Jun 06 '16 14:06 bgerstle

Maybe one quick solution is to disable interactivity while the view is presented?

dzenbot avatar Jul 03 '16 17:07 dzenbot

We have seen this crash as well. I've changed the navigationBar property of DZNWebViewController to strong and also migrated all references to self in the dealloc function to iVars. If crashlytics from the next release shows no further such crashes, I may commit the change to github.

chriswoolfe avatar Aug 04 '16 16:08 chriswoolfe

Hi. Any updates?

mengjang avatar Sep 07 '16 09:09 mengjang

We will release next week, and I'd give it another week to see no crashes in production. So, in another 2 weeks I may commit. The changes mentioned above won't hurt anything, so you may as well give them a try if it is urgent. I just didn't want to commit until I knew for sure.

chriswoolfe avatar Sep 07 '16 13:09 chriswoolfe

Crashlytics was showing at least one crash a day. Now after a week it hasn't shown any. I'm ready to contribute the fix to DZNWebViewController, but I'll need help as this is my first time. I tried to push a new branch with the changes but I don't think I have permission. (Once I can push the branch, I was planning to make a pull request) Could somebody give me permissions to contribute? Thanks!

chriswoolfe avatar Sep 26 '16 18:09 chriswoolfe

Any updates?

O-mkar avatar Nov 02 '16 14:11 O-mkar

When comparing my changes against HEAD, some of them were already done. Since I wasn't able to push to the repository, and unable to create a pull request, I'll just post a screenshot of my changes below. image

chriswoolfe avatar Nov 03 '16 12:11 chriswoolfe

I'm still experiencing this problem with latest 3.2. Most notably, it looks like the suggestion to change UINavigationBar from weak to strong was never made. Getting a few of these crashes a day right now. Will there be a new release with these changes?

JasonTartaglia avatar Feb 20 '17 18:02 JasonTartaglia