{"action":"created","issue":{"url":"https://api.github.com/repos/chrisriesgo/xamarin-forms-carouselview/issues/9","repository_url":"https://api.github.com/repos/chrisriesgo/xamarin-forms-carouselview","labels_url":"https://api.github.com/repos/chrisriesgo/xamarin-forms-carouselview/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/chrisriesgo/xamarin-forms-carouselview/issues/9/comments","events_url":"https://api.github.com/repos/chrisriesgo/xamarin-forms-carouselview/issues/9/events","html_url":"https://github.com/chrisriesgo/xamarin-forms-carouselview/issues/9","id":126476761,"number":9,"title":"Cannot access disposed object","user":{"login":"alexrainman","id":3793554,"avatar_url":"https://avatars.githubusercontent.com/u/3793554?v=3","gravatar_id":"","url":"https://api.github.com/users/alexrainman","html_url":"https://github.com/alexrainman","followers_url":"https://api.github.com/users/alexrainman/followers","following_url":"https://api.github.com/users/alexrainman/following{/other_user}","gists_url":"https://api.github.com/users/alexrainman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexrainman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexrainman/subscriptions","organizations_url":"https://api.github.com/users/alexrainman/orgs","repos_url":"https://api.github.com/users/alexrainman/repos","events_url":"https://api.github.com/users/alexrainman/events{/privacy}","received_events_url":"https://api.github.com/users/alexrainman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-13T17:58:48Z","updated_at":"2016-04-20T04:12:58Z","closed_at":null,"body":"Chris, i discovered and issue with your implementation and a way to fix it. Sometimes the Renderer is collected when you close the screen, then, when you open it again and you try to swipe, it crash because Element is null.\r\n\r\nThe fix?\r\n\r\nAndroid renderer:\r\n\r\n```\r\nvoid ElementPropertyChanged(object sender, PropertyChangedEventArgs e) {\r\n\tif (e.PropertyName == \"Renderer\") {\r\n\t\t_scrollView = (HorizontalScrollView)typeof(ScrollViewRenderer)\r\n\t\t.GetField (\"hScrollView\", BindingFlags.NonPublic | BindingFlags.Instance)\r\n\t\t.GetValue (this);\r\n        _scrollView.HorizontalScrollBarEnabled = false;\r\n\t\t_scrollView.Touch += HScrollViewTouch;\r\n\t}\r\n\r\n\tif (Element == null) return; // this fix the issue\r\n\r\n\tif (e.PropertyName == CarouselLayout.SelectedIndexProperty.PropertyName && !_motionDown) {\r\n\t\tScrollToIndex (((CarouselLayout)this.Element).SelectedIndex);\r\n\t}\r\n}\r\n```\r\n\r\niOS renderer:\r\n\r\n```\r\nvoid ElementPropertyChanged(object sender, PropertyChangedEventArgs e) {\r\n\r\n\tif (Element == null) return; // this fix the issue\r\n\r\n\tif (e.PropertyName == CarouselLayout.SelectedIndexProperty.PropertyName && !Dragging) {\r\n\t\tScrollToSelection (false);\r\n\t}\r\n}\r\n```\r\n\r\nThanks for sharing this.\r\n"},"comment":{"url":"https://api.github.com/repos/chrisriesgo/xamarin-forms-carouselview/issues/comments/212248672","html_url":"https://github.com/chrisriesgo/xamarin-forms-carouselview/issues/9#issuecomment-212248672","issue_url":"https://api.github.com/repos/chrisriesgo/xamarin-forms-carouselview/issues/9","id":212248672,"user":{"login":"DennisWelu","id":2190011,"avatar_url":"https://avatars.githubusercontent.com/u/2190011?v=3","gravatar_id":"","url":"https://api.github.com/users/DennisWelu","html_url":"https://github.com/DennisWelu","followers_url":"https://api.github.com/users/DennisWelu/followers","following_url":"https://api.github.com/users/DennisWelu/following{/other_user}","gists_url":"https://api.github.com/users/DennisWelu/gists{/gist_id}","starred_url":"https://api.github.com/users/DennisWelu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DennisWelu/subscriptions","organizations_url":"https://api.github.com/users/DennisWelu/orgs","repos_url":"https://api.github.com/users/DennisWelu/repos","events_url":"https://api.github.com/users/DennisWelu/events{/privacy}","received_events_url":"https://api.github.com/users/DennisWelu/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T04:12:58Z","updated_at":"2016-04-20T04:12:58Z","body":"@alexrainman Ran into the issue as well and verified your changes fix it, thanks!"}}