{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/13367","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-native","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/13367/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/13367/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/13367/events","html_url":"https://github.com/mapbox/mapbox-gl-native/pull/13367","id":380533872,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNzA4Nzc1","number":13367,"title":"[ios] Added teardown of core objects when receiving UIApplicationWillTerminateNotification","user":{"login":"julianrex","id":3765757,"node_id":"MDQ6VXNlcjM3NjU3NTc=","avatar_url":"https://avatars0.githubusercontent.com/u/3765757?v=4","gravatar_id":"","url":"https://api.github.com/users/julianrex","html_url":"https://github.com/julianrex","followers_url":"https://api.github.com/users/julianrex/followers","following_url":"https://api.github.com/users/julianrex/following{/other_user}","gists_url":"https://api.github.com/users/julianrex/gists{/gist_id}","starred_url":"https://api.github.com/users/julianrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julianrex/subscriptions","organizations_url":"https://api.github.com/users/julianrex/orgs","repos_url":"https://api.github.com/users/julianrex/repos","events_url":"https://api.github.com/users/julianrex/events{/privacy}","received_events_url":"https://api.github.com/users/julianrex/received_events","type":"User","site_admin":false},"labels":[{"id":92400707,"node_id":"MDU6TGFiZWw5MjQwMDcwNw==","url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/iOS","name":"iOS","color":"000000","default":false},{"id":121069548,"node_id":"MDU6TGFiZWwxMjEwNjk1NDg=","url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/refactor","name":"refactor","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":{"login":"julianrex","id":3765757,"node_id":"MDQ6VXNlcjM3NjU3NTc=","avatar_url":"https://avatars0.githubusercontent.com/u/3765757?v=4","gravatar_id":"","url":"https://api.github.com/users/julianrex","html_url":"https://github.com/julianrex","followers_url":"https://api.github.com/users/julianrex/followers","following_url":"https://api.github.com/users/julianrex/following{/other_user}","gists_url":"https://api.github.com/users/julianrex/gists{/gist_id}","starred_url":"https://api.github.com/users/julianrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julianrex/subscriptions","organizations_url":"https://api.github.com/users/julianrex/orgs","repos_url":"https://api.github.com/users/julianrex/repos","events_url":"https://api.github.com/users/julianrex/events{/privacy}","received_events_url":"https://api.github.com/users/julianrex/received_events","type":"User","site_admin":false},"assignees":[{"login":"julianrex","id":3765757,"node_id":"MDQ6VXNlcjM3NjU3NTc=","avatar_url":"https://avatars0.githubusercontent.com/u/3765757?v=4","gravatar_id":"","url":"https://api.github.com/users/julianrex","html_url":"https://github.com/julianrex","followers_url":"https://api.github.com/users/julianrex/followers","following_url":"https://api.github.com/users/julianrex/following{/other_user}","gists_url":"https://api.github.com/users/julianrex/gists{/gist_id}","starred_url":"https://api.github.com/users/julianrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julianrex/subscriptions","organizations_url":"https://api.github.com/users/julianrex/orgs","repos_url":"https://api.github.com/users/julianrex/repos","events_url":"https://api.github.com/users/julianrex/events{/privacy}","received_events_url":"https://api.github.com/users/julianrex/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/137","html_url":"https://github.com/mapbox/mapbox-gl-native/milestone/137","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/137/labels","id":3798201,"node_id":"MDk6TWlsZXN0b25lMzc5ODIwMQ==","number":137,"title":"release-iowaska","description":"`ios-v4.7.0`, `android-v7.0.0`, `macos-v0.13.0`","creator":{"login":"friedbunny","id":1198851,"node_id":"MDQ6VXNlcjExOTg4NTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1198851?v=4","gravatar_id":"","url":"https://api.github.com/users/friedbunny","html_url":"https://github.com/friedbunny","followers_url":"https://api.github.com/users/friedbunny/followers","following_url":"https://api.github.com/users/friedbunny/following{/other_user}","gists_url":"https://api.github.com/users/friedbunny/gists{/gist_id}","starred_url":"https://api.github.com/users/friedbunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friedbunny/subscriptions","organizations_url":"https://api.github.com/users/friedbunny/orgs","repos_url":"https://api.github.com/users/friedbunny/repos","events_url":"https://api.github.com/users/friedbunny/events{/privacy}","received_events_url":"https://api.github.com/users/friedbunny/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":4,"state":"open","created_at":"2018-11-05T21:29:50Z","updated_at":"2018-11-14T16:28:49Z","due_on":"2018-12-05T08:00:00Z","closed_at":null},"comments":1,"created_at":"2018-11-14T04:44:45Z","updated_at":"2018-11-14T19:37:32Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/13367","html_url":"https://github.com/mapbox/mapbox-gl-native/pull/13367","diff_url":"https://github.com/mapbox/mapbox-gl-native/pull/13367.diff","patch_url":"https://github.com/mapbox/mapbox-gl-native/pull/13367.patch"},"body":"Addresses #13120 (random crashes on app termination), by tearing down the underlying core C++ objects when receiving `UIApplicationWillTerminateNotification`.\r\n\r\nThis PR also saves the state of the `camera`, `debugMask` and `styleURL` during tear-down, so that they can be used when saving state (e.g. in `iosapp`\r\nhttps://github.com/mapbox/mapbox-gl-native/blob/f4e5d842cbe15915a8854525ca928a914ba29eef/platform/ios/app/MBXViewController.m#L290)\r\n\r\nIn addition, this PR changes accesses to the underlying `mbgl::Map` to go via a method (`-(mbgl::Map &)[MGLMapView mbglMap]`) that raises an exception if the map is `NULL`.\r\n\r\nThis PR does *not* introduce `UIStateRestoring` conformance (see https://github.com/mapbox/mapbox-gl-native/issues/3660), but could be viewed as a prelude to that work.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments/438790861","html_url":"https://github.com/mapbox/mapbox-gl-native/pull/13367#issuecomment-438790861","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/13367","id":438790861,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODc5MDg2MQ==","user":{"login":"julianrex","id":3765757,"node_id":"MDQ6VXNlcjM3NjU3NTc=","avatar_url":"https://avatars0.githubusercontent.com/u/3765757?v=4","gravatar_id":"","url":"https://api.github.com/users/julianrex","html_url":"https://github.com/julianrex","followers_url":"https://api.github.com/users/julianrex/followers","following_url":"https://api.github.com/users/julianrex/following{/other_user}","gists_url":"https://api.github.com/users/julianrex/gists{/gist_id}","starred_url":"https://api.github.com/users/julianrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julianrex/subscriptions","organizations_url":"https://api.github.com/users/julianrex/orgs","repos_url":"https://api.github.com/users/julianrex/repos","events_url":"https://api.github.com/users/julianrex/events{/privacy}","received_events_url":"https://api.github.com/users/julianrex/received_events","type":"User","site_admin":false},"created_at":"2018-11-14T19:37:32Z","updated_at":"2018-11-14T19:37:32Z","author_association":"CONTRIBUTOR","body":"> I'm wondering if all the checks to handle calling MGLMapView methods after it has destroyed the underlying map are actually necessary -- willTerminate itself shouldn't call back into any of those methods, right?\r\n\r\nThe problem is that \"other things\" may be observing `UIApplicationWillTerminateNotification` and request properties on `MGLMapView`. In fact, that's exactly what happens with the current `iosapp` - it tries to save state, accessing `MGLMapView.camera`, which access the underlying (now gone) `mbgl::Map` and Boom.\r\n\r\nMy understanding is that at termination, the order goes something like:\r\n1. Call application's `applicationWillTerminate:` method\r\n2. Post notification (order of delivery is undefined)\r\n3. exit\r\n\r\nI changed the accesses to `_mbglMap` to go via a method (that raises an exception) to catch any other possible problems. This might be a game of whack-a-mole though.\r\n\r\n> Also: I think in the same PR we should address other SDK objects that could be holding onto core objects that need teardown. The one I have in mind is MGLMapSnapshotter (which could also have worker threads running).\r\n\r\nI'd like to get this PR in, so ideally this would be tail work. But you're right - I think we could have a bunch of things hanging on to core objects... (see also https://github.com/mapbox/mapbox-gl-native/pull/13356#discussion_r233506556)"}}
{"actor":{"display_login":"julianrex"}}