{"action":"created","comment":{"url":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/comments/23677200","id":23677200,"diff_hunk":"@@ -31,21 +23,66 @@ public partial class OpenGLControl : UserControl\n         public OpenGLControl()\r\n         {\r\n             InitializeComponent();\r\n-            SizeChanged += new SizeChangedEventHandler(OpenGLControl_SizeChanged);\r\n+\r\n+            timer = new DispatcherTimer();\r\n+\r\n+            Unloaded += OpenGLControl_Unloaded;\r\n+            Loaded += OpenGLControl_Loaded;\r\n+        }\r\n+\r\n+        /// <summary>\r\n+        /// Handles the Loaded event of the OpenGLControl control.\r\n+        /// </summary>\r\n+        /// <param name=\"sender\">The source of the event.</param>\r\n+        /// <param name=\"e\">The <see cref=\"System.Windows.RoutedEventArgs\"/> Instance containing the event data.</param>\r\n+        private void OpenGLControl_Loaded(object sender, RoutedEventArgs routedEventArgs)\r\n+        {\r\n+            SizeChanged += OpenGLControl_SizeChanged;\r\n+\r\n+            timer.Tick -= timer_Tick;\r\n+            timer.Tick += timer_Tick; // to avoid twice call, ensure timer_Tick event handler is registered only once, because it is also registred on apply template\r\n+\r\n+            UpdateOpenGLControl((int) RenderSize.Width, (int) RenderSize.Height);\r\n+\r\n+            //  DispatcherTimer setup\r\n+            timer.Tick += new EventHandler(timer_Tick);\r","path":"source/SharpGL/Core/SharpGL.WPF/OpenGLControl.xaml.cs","position":51,"original_position":51,"commit_id":"98e2224637b77bc210f685a962a178ce2a038ff7","original_commit_id":"98e2224637b77bc210f685a962a178ce2a038ff7","user":{"login":"dwmkerr","id":1926984,"avatar_url":"https://avatars.githubusercontent.com/u/1926984?v=3","gravatar_id":"","url":"https://api.github.com/users/dwmkerr","html_url":"https://github.com/dwmkerr","followers_url":"https://api.github.com/users/dwmkerr/followers","following_url":"https://api.github.com/users/dwmkerr/following{/other_user}","gists_url":"https://api.github.com/users/dwmkerr/gists{/gist_id}","starred_url":"https://api.github.com/users/dwmkerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwmkerr/subscriptions","organizations_url":"https://api.github.com/users/dwmkerr/orgs","repos_url":"https://api.github.com/users/dwmkerr/repos","events_url":"https://api.github.com/users/dwmkerr/events{/privacy}","received_events_url":"https://api.github.com/users/dwmkerr/received_events","type":"User","site_admin":false},"body":"both lines 42 and 43 can go, there should be no way to have the event handler registered twice so no need to deregister it on `Loaded`","created_at":"2015-01-28T10:18:11Z","updated_at":"2015-01-28T10:18:11Z","html_url":"https://github.com/dwmkerr/sharpgl/pull/74#discussion_r23677200","pull_request_url":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/comments/23677200"},"html":{"href":"https://github.com/dwmkerr/sharpgl/pull/74#discussion_r23677200"},"pull_request":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74","id":27993384,"html_url":"https://github.com/dwmkerr/sharpgl/pull/74","diff_url":"https://github.com/dwmkerr/sharpgl/pull/74.diff","patch_url":"https://github.com/dwmkerr/sharpgl/pull/74.patch","issue_url":"https://api.github.com/repos/dwmkerr/sharpgl/issues/74","number":74,"state":"open","locked":false,"title":"Memory leak in wpf control","user":{"login":"robinsedlaczek","id":2900224,"avatar_url":"https://avatars.githubusercontent.com/u/2900224?v=3","gravatar_id":"","url":"https://api.github.com/users/robinsedlaczek","html_url":"https://github.com/robinsedlaczek","followers_url":"https://api.github.com/users/robinsedlaczek/followers","following_url":"https://api.github.com/users/robinsedlaczek/following{/other_user}","gists_url":"https://api.github.com/users/robinsedlaczek/gists{/gist_id}","starred_url":"https://api.github.com/users/robinsedlaczek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robinsedlaczek/subscriptions","organizations_url":"https://api.github.com/users/robinsedlaczek/orgs","repos_url":"https://api.github.com/users/robinsedlaczek/repos","events_url":"https://api.github.com/users/robinsedlaczek/events{/privacy}","received_events_url":"https://api.github.com/users/robinsedlaczek/received_events","type":"User","site_admin":false},"body":"Sorry, I did the mistake with the target again. I have to be more familiar with Git. Sorry for this.","created_at":"2015-01-25T15:32:26Z","updated_at":"2015-01-28T10:18:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42f0d31c6b6aef8bdc2baa6ba008a321c1b5ea4f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74/commits","review_comments_url":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74/comments","review_comment_url":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dwmkerr/sharpgl/issues/74/comments","statuses_url":"https://api.github.com/repos/dwmkerr/sharpgl/statuses/98e2224637b77bc210f685a962a178ce2a038ff7","head":{"label":"robinsedlaczek:MemoryLeakInWpfControl","ref":"MemoryLeakInWpfControl","sha":"98e2224637b77bc210f685a962a178ce2a038ff7","user":{"login":"robinsedlaczek","id":2900224,"avatar_url":"https://avatars.githubusercontent.com/u/2900224?v=3","gravatar_id":"","url":"https://api.github.com/users/robinsedlaczek","html_url":"https://github.com/robinsedlaczek","followers_url":"https://api.github.com/users/robinsedlaczek/followers","following_url":"https://api.github.com/users/robinsedlaczek/following{/other_user}","gists_url":"https://api.github.com/users/robinsedlaczek/gists{/gist_id}","starred_url":"https://api.github.com/users/robinsedlaczek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robinsedlaczek/subscriptions","organizations_url":"https://api.github.com/users/robinsedlaczek/orgs","repos_url":"https://api.github.com/users/robinsedlaczek/repos","events_url":"https://api.github.com/users/robinsedlaczek/events{/privacy}","received_events_url":"https://api.github.com/users/robinsedlaczek/received_events","type":"User","site_admin":false},"repo":{"id":22839189,"name":"sharpgl","full_name":"robinsedlaczek/sharpgl","owner":{"login":"robinsedlaczek","id":2900224,"avatar_url":"https://avatars.githubusercontent.com/u/2900224?v=3","gravatar_id":"","url":"https://api.github.com/users/robinsedlaczek","html_url":"https://github.com/robinsedlaczek","followers_url":"https://api.github.com/users/robinsedlaczek/followers","following_url":"https://api.github.com/users/robinsedlaczek/following{/other_user}","gists_url":"https://api.github.com/users/robinsedlaczek/gists{/gist_id}","starred_url":"https://api.github.com/users/robinsedlaczek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robinsedlaczek/subscriptions","organizations_url":"https://api.github.com/users/robinsedlaczek/orgs","repos_url":"https://api.github.com/users/robinsedlaczek/repos","events_url":"https://api.github.com/users/robinsedlaczek/events{/privacy}","received_events_url":"https://api.github.com/users/robinsedlaczek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robinsedlaczek/sharpgl","description":"Use OpenGL in .NET applications. SharpGL wraps all modern OpenGL features and offers a powerful scene graph to aid development.","fork":true,"url":"https://api.github.com/repos/robinsedlaczek/sharpgl","forks_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/forks","keys_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/teams","hooks_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/hooks","issue_events_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/issues/events{/number}","events_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/events","assignees_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/assignees{/user}","branches_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/branches{/branch}","tags_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/tags","blobs_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/git/refs{/sha}","trees_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/statuses/{sha}","languages_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/languages","stargazers_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/stargazers","contributors_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/contributors","subscribers_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/subscribers","subscription_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/subscription","commits_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/commits{/sha}","git_commits_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/git/commits{/sha}","comments_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/comments{/number}","issue_comment_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/issues/comments/{number}","contents_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/contents/{+path}","compare_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/merges","archive_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/downloads","issues_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/issues{/number}","pulls_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/pulls{/number}","milestones_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/milestones{/number}","notifications_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/labels{/name}","releases_url":"https://api.github.com/repos/robinsedlaczek/sharpgl/releases{/id}","created_at":"2014-08-11T13:02:59Z","updated_at":"2015-01-02T17:21:11Z","pushed_at":"2015-01-28T09:28:58Z","git_url":"git://github.com/robinsedlaczek/sharpgl.git","ssh_url":"git@github.com:robinsedlaczek/sharpgl.git","clone_url":"https://github.com/robinsedlaczek/sharpgl.git","svn_url":"https://github.com/robinsedlaczek/sharpgl","homepage":null,"size":4403,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dwmkerr:v/2.4","ref":"v/2.4","sha":"b10ce05d0792afd0802dcb299eec1a5361143c50","user":{"login":"dwmkerr","id":1926984,"avatar_url":"https://avatars.githubusercontent.com/u/1926984?v=3","gravatar_id":"","url":"https://api.github.com/users/dwmkerr","html_url":"https://github.com/dwmkerr","followers_url":"https://api.github.com/users/dwmkerr/followers","following_url":"https://api.github.com/users/dwmkerr/following{/other_user}","gists_url":"https://api.github.com/users/dwmkerr/gists{/gist_id}","starred_url":"https://api.github.com/users/dwmkerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwmkerr/subscriptions","organizations_url":"https://api.github.com/users/dwmkerr/orgs","repos_url":"https://api.github.com/users/dwmkerr/repos","events_url":"https://api.github.com/users/dwmkerr/events{/privacy}","received_events_url":"https://api.github.com/users/dwmkerr/received_events","type":"User","site_admin":false},"repo":{"id":12570375,"name":"sharpgl","full_name":"dwmkerr/sharpgl","owner":{"login":"dwmkerr","id":1926984,"avatar_url":"https://avatars.githubusercontent.com/u/1926984?v=3","gravatar_id":"","url":"https://api.github.com/users/dwmkerr","html_url":"https://github.com/dwmkerr","followers_url":"https://api.github.com/users/dwmkerr/followers","following_url":"https://api.github.com/users/dwmkerr/following{/other_user}","gists_url":"https://api.github.com/users/dwmkerr/gists{/gist_id}","starred_url":"https://api.github.com/users/dwmkerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwmkerr/subscriptions","organizations_url":"https://api.github.com/users/dwmkerr/orgs","repos_url":"https://api.github.com/users/dwmkerr/repos","events_url":"https://api.github.com/users/dwmkerr/events{/privacy}","received_events_url":"https://api.github.com/users/dwmkerr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dwmkerr/sharpgl","description":"Use OpenGL in .NET applications. SharpGL wraps all modern OpenGL features and offers a powerful scene graph to aid development.","fork":false,"url":"https://api.github.com/repos/dwmkerr/sharpgl","forks_url":"https://api.github.com/repos/dwmkerr/sharpgl/forks","keys_url":"https://api.github.com/repos/dwmkerr/sharpgl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwmkerr/sharpgl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwmkerr/sharpgl/teams","hooks_url":"https://api.github.com/repos/dwmkerr/sharpgl/hooks","issue_events_url":"https://api.github.com/repos/dwmkerr/sharpgl/issues/events{/number}","events_url":"https://api.github.com/repos/dwmkerr/sharpgl/events","assignees_url":"https://api.github.com/repos/dwmkerr/sharpgl/assignees{/user}","branches_url":"https://api.github.com/repos/dwmkerr/sharpgl/branches{/branch}","tags_url":"https://api.github.com/repos/dwmkerr/sharpgl/tags","blobs_url":"https://api.github.com/repos/dwmkerr/sharpgl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwmkerr/sharpgl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwmkerr/sharpgl/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwmkerr/sharpgl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwmkerr/sharpgl/statuses/{sha}","languages_url":"https://api.github.com/repos/dwmkerr/sharpgl/languages","stargazers_url":"https://api.github.com/repos/dwmkerr/sharpgl/stargazers","contributors_url":"https://api.github.com/repos/dwmkerr/sharpgl/contributors","subscribers_url":"https://api.github.com/repos/dwmkerr/sharpgl/subscribers","subscription_url":"https://api.github.com/repos/dwmkerr/sharpgl/subscription","commits_url":"https://api.github.com/repos/dwmkerr/sharpgl/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwmkerr/sharpgl/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwmkerr/sharpgl/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwmkerr/sharpgl/issues/comments/{number}","contents_url":"https://api.github.com/repos/dwmkerr/sharpgl/contents/{+path}","compare_url":"https://api.github.com/repos/dwmkerr/sharpgl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwmkerr/sharpgl/merges","archive_url":"https://api.github.com/repos/dwmkerr/sharpgl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwmkerr/sharpgl/downloads","issues_url":"https://api.github.com/repos/dwmkerr/sharpgl/issues{/number}","pulls_url":"https://api.github.com/repos/dwmkerr/sharpgl/pulls{/number}","milestones_url":"https://api.github.com/repos/dwmkerr/sharpgl/milestones{/number}","notifications_url":"https://api.github.com/repos/dwmkerr/sharpgl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwmkerr/sharpgl/labels{/name}","releases_url":"https://api.github.com/repos/dwmkerr/sharpgl/releases{/id}","created_at":"2013-09-03T17:34:25Z","updated_at":"2015-01-20T14:39:50Z","pushed_at":"2015-01-28T09:05:52Z","git_url":"git://github.com/dwmkerr/sharpgl.git","ssh_url":"git@github.com:dwmkerr/sharpgl.git","clone_url":"https://github.com/dwmkerr/sharpgl.git","svn_url":"https://github.com/dwmkerr/sharpgl","homepage":null,"size":6954,"stargazers_count":64,"watchers_count":64,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":36,"forks":41,"open_issues":36,"watchers":64,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74"},"html":{"href":"https://github.com/dwmkerr/sharpgl/pull/74"},"issue":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/issues/74"},"comments":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/dwmkerr/sharpgl/statuses/98e2224637b77bc210f685a962a178ce2a038ff7"}}}}