{"action":"created","comment":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/29891929","id":29891929,"diff_hunk":"@@ -176,34 +175,31 @@ void LoadAsyncInternal()\n \t\t\t\t\t\tbitmap = Minimap.RenderMapPreview(modData.DefaultRules.TileSets[p.Map.Tileset], p.Map, modData.DefaultRules, true);\n \t\t\t\t\t}\n \n-\t\t\t\t\t// Note: this is not generally thread-safe, but it works here because:\n-\t\t\t\t\t//   (a) This worker is the only thread writing to this sheet\n-\t\t\t\t\t//   (b) The main thread is the only thread reading this sheet\n-\t\t\t\t\t//   (c) The sheet is marked dirty after the write is completed,\n-\t\t\t\t\t//       which causes the main thread to copy this to the texture during\n-\t\t\t\t\t//       the next render cycle.\n-\t\t\t\t\t//   (d) Any partially written bytes from the next minimap is in an\n-\t\t\t\t\t//       unallocated area, and will be committed in the next cycle.\n-\t\t\t\t\ttry\n+\t\t\t\t\tGame.RunAfterTick(() =>\n \t\t\t\t\t{\n-\t\t\t\t\t\tp.SetMinimap(sheetBuilder.Add(bitmap));\n-\t\t\t\t\t}\n-\t\t\t\t\tfinally\n-\t\t\t\t\t{\n-\t\t\t\t\t\tif (createdPreview)\n-\t\t\t\t\t\t\tbitmap.Dispose();\n-\t\t\t\t\t}\n+\t\t\t\t\t\ttry\n+\t\t\t\t\t\t{\n+\t\t\t\t\t\t\tp.SetMinimap(sheetBuilder.Add(bitmap));","path":"OpenRA.Game/Map/MapCache.cs","position":32,"original_position":32,"commit_id":"3b5a672848444d24b2a18d46d6cd175df6567dd5","original_commit_id":"3b5a672848444d24b2a18d46d6cd175df6567dd5","user":{"login":"RoosterDragon","id":3399086,"avatar_url":"https://avatars.githubusercontent.com/u/3399086?v=3","gravatar_id":"","url":"https://api.github.com/users/RoosterDragon","html_url":"https://github.com/RoosterDragon","followers_url":"https://api.github.com/users/RoosterDragon/followers","following_url":"https://api.github.com/users/RoosterDragon/following{/other_user}","gists_url":"https://api.github.com/users/RoosterDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/RoosterDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoosterDragon/subscriptions","organizations_url":"https://api.github.com/users/RoosterDragon/orgs","repos_url":"https://api.github.com/users/RoosterDragon/repos","events_url":"https://api.github.com/users/RoosterDragon/events{/privacy}","received_events_url":"https://api.github.com/users/RoosterDragon/received_events","type":"User","site_admin":false},"body":"Check the stacktrace in #8049. It tries creating the managed buffer from the worker thread and dies.\r\n\r\nThis will be as a result of the memory saving measures from #6756. Since we no longer keep the managed buffer around forever, the old comment hasn't been correct since then.","created_at":"2015-05-07T20:22:27Z","updated_at":"2015-05-07T20:22:27Z","html_url":"https://github.com/OpenRA/OpenRA/pull/8103#discussion_r29891929","pull_request_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103","_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/29891929"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/8103#discussion_r29891929"},"pull_request":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103"}}},"pull_request":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103","id":34952973,"html_url":"https://github.com/OpenRA/OpenRA/pull/8103","diff_url":"https://github.com/OpenRA/OpenRA/pull/8103.diff","patch_url":"https://github.com/OpenRA/OpenRA/pull/8103.patch","issue_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/8103","number":8103,"state":"open","locked":false,"title":"Fix graphical glitches & crashes related to map loading","user":{"login":"RoosterDragon","id":3399086,"avatar_url":"https://avatars.githubusercontent.com/u/3399086?v=3","gravatar_id":"","url":"https://api.github.com/users/RoosterDragon","html_url":"https://github.com/RoosterDragon","followers_url":"https://api.github.com/users/RoosterDragon/followers","following_url":"https://api.github.com/users/RoosterDragon/following{/other_user}","gists_url":"https://api.github.com/users/RoosterDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/RoosterDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoosterDragon/subscriptions","organizations_url":"https://api.github.com/users/RoosterDragon/orgs","repos_url":"https://api.github.com/users/RoosterDragon/repos","events_url":"https://api.github.com/users/RoosterDragon/events{/privacy}","received_events_url":"https://api.github.com/users/RoosterDragon/received_events","type":"User","site_admin":false},"body":"Fixes #7877 \r\nFixes #8049\r\n\r\nAlways access the SheetBuilder from the main thread in MapCache.\r\n\r\nNot doing this can occasionally this can result in a cross thread call to the backing texture which leads to bad things. This stops trying to be clever regarding the thread safety invariants exposed by SheetBuilder and does things simply and safely: All updates happen on the main thread.","created_at":"2015-05-07T20:06:11Z","updated_at":"2015-05-07T20:22:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d795d4e2705c4be0798927d82404dd5aa7d73cf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103/commits","review_comments_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103/comments","review_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/8103/comments","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/3b5a672848444d24b2a18d46d6cd175df6567dd5","head":{"label":"RoosterDragon:mapcache-better-threading","ref":"mapcache-better-threading","sha":"3b5a672848444d24b2a18d46d6cd175df6567dd5","user":{"login":"RoosterDragon","id":3399086,"avatar_url":"https://avatars.githubusercontent.com/u/3399086?v=3","gravatar_id":"","url":"https://api.github.com/users/RoosterDragon","html_url":"https://github.com/RoosterDragon","followers_url":"https://api.github.com/users/RoosterDragon/followers","following_url":"https://api.github.com/users/RoosterDragon/following{/other_user}","gists_url":"https://api.github.com/users/RoosterDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/RoosterDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoosterDragon/subscriptions","organizations_url":"https://api.github.com/users/RoosterDragon/orgs","repos_url":"https://api.github.com/users/RoosterDragon/repos","events_url":"https://api.github.com/users/RoosterDragon/events{/privacy}","received_events_url":"https://api.github.com/users/RoosterDragon/received_events","type":"User","site_admin":false},"repo":{"id":20080394,"name":"OpenRA","full_name":"RoosterDragon/OpenRA","owner":{"login":"RoosterDragon","id":3399086,"avatar_url":"https://avatars.githubusercontent.com/u/3399086?v=3","gravatar_id":"","url":"https://api.github.com/users/RoosterDragon","html_url":"https://github.com/RoosterDragon","followers_url":"https://api.github.com/users/RoosterDragon/followers","following_url":"https://api.github.com/users/RoosterDragon/following{/other_user}","gists_url":"https://api.github.com/users/RoosterDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/RoosterDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoosterDragon/subscriptions","organizations_url":"https://api.github.com/users/RoosterDragon/orgs","repos_url":"https://api.github.com/users/RoosterDragon/repos","events_url":"https://api.github.com/users/RoosterDragon/events{/privacy}","received_events_url":"https://api.github.com/users/RoosterDragon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RoosterDragon/OpenRA","description":"An open-source implementation of the Red Alert engine using .NET/mono and OpenGL. Runs on Windows, Linux and Mac OS X.","fork":true,"url":"https://api.github.com/repos/RoosterDragon/OpenRA","forks_url":"https://api.github.com/repos/RoosterDragon/OpenRA/forks","keys_url":"https://api.github.com/repos/RoosterDragon/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RoosterDragon/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RoosterDragon/OpenRA/teams","hooks_url":"https://api.github.com/repos/RoosterDragon/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/RoosterDragon/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/RoosterDragon/OpenRA/events","assignees_url":"https://api.github.com/repos/RoosterDragon/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/RoosterDragon/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/RoosterDragon/OpenRA/tags","blobs_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RoosterDragon/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/RoosterDragon/OpenRA/languages","stargazers_url":"https://api.github.com/repos/RoosterDragon/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/RoosterDragon/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/RoosterDragon/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/RoosterDragon/OpenRA/subscription","commits_url":"https://api.github.com/repos/RoosterDragon/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/RoosterDragon/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/RoosterDragon/OpenRA/issues/comments{/number}","contents_url":"https://api.github.com/repos/RoosterDragon/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/RoosterDragon/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RoosterDragon/OpenRA/merges","archive_url":"https://api.github.com/repos/RoosterDragon/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RoosterDragon/OpenRA/downloads","issues_url":"https://api.github.com/repos/RoosterDragon/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/RoosterDragon/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/RoosterDragon/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/RoosterDragon/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RoosterDragon/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/RoosterDragon/OpenRA/releases{/id}","created_at":"2014-05-22T23:21:53Z","updated_at":"2015-05-07T19:04:35Z","pushed_at":"2015-05-07T20:11:50Z","git_url":"git://github.com/RoosterDragon/OpenRA.git","ssh_url":"git@github.com:RoosterDragon/OpenRA.git","clone_url":"https://github.com/RoosterDragon/OpenRA.git","svn_url":"https://github.com/RoosterDragon/OpenRA","homepage":"http://open-ra.org","size":87593,"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":"bleed"}},"base":{"label":"OpenRA:bleed","ref":"bleed","sha":"2e11b5d809b020e1f037232f6a5910a077a3a16e","user":{"login":"OpenRA","id":409046,"avatar_url":"https://avatars.githubusercontent.com/u/409046?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"repo":{"id":959908,"name":"OpenRA","full_name":"OpenRA/OpenRA","owner":{"login":"OpenRA","id":409046,"avatar_url":"https://avatars.githubusercontent.com/u/409046?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenRA/OpenRA","description":"An open-source implementation of the Command & Conquer: Red Alert engine using .NET/Mono and OpenGL. Runs on Windows, Linux and Mac OS X.","fork":false,"url":"https://api.github.com/repos/OpenRA/OpenRA","forks_url":"https://api.github.com/repos/OpenRA/OpenRA/forks","keys_url":"https://api.github.com/repos/OpenRA/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenRA/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenRA/OpenRA/teams","hooks_url":"https://api.github.com/repos/OpenRA/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/OpenRA/OpenRA/events","assignees_url":"https://api.github.com/repos/OpenRA/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/OpenRA/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/OpenRA/OpenRA/tags","blobs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenRA/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenRA/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenRA/OpenRA/languages","stargazers_url":"https://api.github.com/repos/OpenRA/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/OpenRA/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/OpenRA/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/OpenRA/OpenRA/subscription","commits_url":"https://api.github.com/repos/OpenRA/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenRA/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenRA/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/OpenRA/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenRA/OpenRA/merges","archive_url":"https://api.github.com/repos/OpenRA/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenRA/OpenRA/downloads","issues_url":"https://api.github.com/repos/OpenRA/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenRA/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenRA/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenRA/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/OpenRA/OpenRA/releases{/id}","created_at":"2010-10-04T07:38:05Z","updated_at":"2015-05-07T17:23:45Z","pushed_at":"2015-05-07T20:11:51Z","git_url":"git://github.com/OpenRA/OpenRA.git","ssh_url":"git@github.com:OpenRA/OpenRA.git","clone_url":"https://github.com/OpenRA/OpenRA.git","svn_url":"https://github.com/OpenRA/OpenRA","homepage":"http://www.openra.net","size":174012,"stargazers_count":1892,"watchers_count":1892,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":687,"mirror_url":null,"open_issues_count":796,"forks":687,"open_issues":796,"watchers":1892,"default_branch":"bleed"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/8103"},"issue":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/8103"},"comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/8103/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/8103/commits"},"statuses":{"href":"https://api.github.com/repos/OpenRA/OpenRA/statuses/3b5a672848444d24b2a18d46d6cd175df6567dd5"}}}}