{"action":"closed","number":1515,"pull_request":{"url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/1515","id":153448662,"html_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/1515","diff_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/1515.diff","patch_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/1515.patch","issue_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/1515","number":1515,"state":"closed","locked":false,"title":"Avoid exception when closing FRED related to bm_release().","user":{"login":"MageKing17","id":2095329,"avatar_url":"https://avatars2.githubusercontent.com/u/2095329?v=4","gravatar_id":"","url":"https://api.github.com/users/MageKing17","html_url":"https://github.com/MageKing17","followers_url":"https://api.github.com/users/MageKing17/followers","following_url":"https://api.github.com/users/MageKing17/following{/other_user}","gists_url":"https://api.github.com/users/MageKing17/gists{/gist_id}","starred_url":"https://api.github.com/users/MageKing17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MageKing17/subscriptions","organizations_url":"https://api.github.com/users/MageKing17/orgs","repos_url":"https://api.github.com/users/MageKing17/repos","events_url":"https://api.github.com/users/MageKing17/events{/privacy}","received_events_url":"https://api.github.com/users/MageKing17/received_events","type":"User","site_admin":false},"body":"Now that BMPMAN dynamically allocates the `bm_bitmaps` array, and deallocates it in `bm_close()`, which is explicitly called by `gr_close()`, FRED generates an exception on close because of trying to release bitmap handles after `bm_bitmaps` has been deallocated and set to null. This is because `gr_close()` is called by `CFREDView::OnDestroy()`, but the mission textures aren't fully paged out until `CMainFrame::OnClose()` (well, technically, `CMainFrame::OnClose()` calls `CFrameWnd::OnClose()`, which calls `CWinApp::CloseAllDocuments()`, which calls `CDocManager::CloseAllDocuments()`, which calls `CDocTemplate::CloseAllDocuments()`, which calls `CDocument::OnCloseDocument()`, which calls `CFREDDoc::DeleteContents()`, which calls `CFREDDoc::editor_init_mission()`, which calls `reset_mission()`, which calls `clear_mission()`, which calls `model_free_all()`, which calls `model_instance_free_all()`, which calls `model_unload()` for every model, which calls `model_page_out_textures()`, which *finally* calls the crashing `bm_release()`). This commit moves the `gr_close()` call to `CMainFrame::OnClose()`, *after* it calls `CFrameWnd::OnClose()`, which avoids the exception as `bm_bitmaps` is still intact long enough for those final textures to be freed from it.","created_at":"2017-11-18T12:40:32Z","updated_at":"2017-11-18T22:49:15Z","closed_at":"2017-11-18T22:49:15Z","merged_at":"2017-11-18T22:49:15Z","merge_commit_sha":"1a94018fb423a756b38428bbfb24bd1febbaf7f9","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/1515/commits","review_comments_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/1515/comments","review_comment_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/1515/comments","statuses_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/statuses/e8ef727a199f00b44b0fe186e498bf5bbb823897","head":{"label":"MageKing17:bugfix/fred-close-exception","ref":"bugfix/fred-close-exception","sha":"e8ef727a199f00b44b0fe186e498bf5bbb823897","user":{"login":"MageKing17","id":2095329,"avatar_url":"https://avatars2.githubusercontent.com/u/2095329?v=4","gravatar_id":"","url":"https://api.github.com/users/MageKing17","html_url":"https://github.com/MageKing17","followers_url":"https://api.github.com/users/MageKing17/followers","following_url":"https://api.github.com/users/MageKing17/following{/other_user}","gists_url":"https://api.github.com/users/MageKing17/gists{/gist_id}","starred_url":"https://api.github.com/users/MageKing17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MageKing17/subscriptions","organizations_url":"https://api.github.com/users/MageKing17/orgs","repos_url":"https://api.github.com/users/MageKing17/repos","events_url":"https://api.github.com/users/MageKing17/events{/privacy}","received_events_url":"https://api.github.com/users/MageKing17/received_events","type":"User","site_admin":false},"repo":{"id":34633985,"name":"fs2open.github.com","full_name":"MageKing17/fs2open.github.com","owner":{"login":"MageKing17","id":2095329,"avatar_url":"https://avatars2.githubusercontent.com/u/2095329?v=4","gravatar_id":"","url":"https://api.github.com/users/MageKing17","html_url":"https://github.com/MageKing17","followers_url":"https://api.github.com/users/MageKing17/followers","following_url":"https://api.github.com/users/MageKing17/following{/other_user}","gists_url":"https://api.github.com/users/MageKing17/gists{/gist_id}","starred_url":"https://api.github.com/users/MageKing17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MageKing17/subscriptions","organizations_url":"https://api.github.com/users/MageKing17/orgs","repos_url":"https://api.github.com/users/MageKing17/repos","events_url":"https://api.github.com/users/MageKing17/events{/privacy}","received_events_url":"https://api.github.com/users/MageKing17/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MageKing17/fs2open.github.com","description":"Forked repository for FreeSpace 2 Open","fork":true,"url":"https://api.github.com/repos/MageKing17/fs2open.github.com","forks_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/forks","keys_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/teams","hooks_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/hooks","issue_events_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/issues/events{/number}","events_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/events","assignees_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/assignees{/user}","branches_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/branches{/branch}","tags_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/tags","blobs_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/statuses/{sha}","languages_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/languages","stargazers_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/stargazers","contributors_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/contributors","subscribers_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/subscribers","subscription_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/subscription","commits_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/contents/{+path}","compare_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/merges","archive_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/downloads","issues_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/issues{/number}","pulls_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/pulls{/number}","milestones_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/milestones{/number}","notifications_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/labels{/name}","releases_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/releases{/id}","deployments_url":"https://api.github.com/repos/MageKing17/fs2open.github.com/deployments","created_at":"2015-04-26T22:18:19Z","updated_at":"2017-01-28T19:14:49Z","pushed_at":"2017-11-18T12:38:37Z","git_url":"git://github.com/MageKing17/fs2open.github.com.git","ssh_url":"git@github.com:MageKing17/fs2open.github.com.git","clone_url":"https://github.com/MageKing17/fs2open.github.com.git","svn_url":"https://github.com/MageKing17/fs2open.github.com","homepage":"","size":128912,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scp-fs2open:master","ref":"master","sha":"dfdfd59367e3d1fabb91705388d10eaa112958ca","user":{"login":"scp-fs2open","id":3302806,"avatar_url":"https://avatars3.githubusercontent.com/u/3302806?v=4","gravatar_id":"","url":"https://api.github.com/users/scp-fs2open","html_url":"https://github.com/scp-fs2open","followers_url":"https://api.github.com/users/scp-fs2open/followers","following_url":"https://api.github.com/users/scp-fs2open/following{/other_user}","gists_url":"https://api.github.com/users/scp-fs2open/gists{/gist_id}","starred_url":"https://api.github.com/users/scp-fs2open/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scp-fs2open/subscriptions","organizations_url":"https://api.github.com/users/scp-fs2open/orgs","repos_url":"https://api.github.com/users/scp-fs2open/repos","events_url":"https://api.github.com/users/scp-fs2open/events{/privacy}","received_events_url":"https://api.github.com/users/scp-fs2open/received_events","type":"Organization","site_admin":false},"repo":{"id":7700081,"name":"fs2open.github.com","full_name":"scp-fs2open/fs2open.github.com","owner":{"login":"scp-fs2open","id":3302806,"avatar_url":"https://avatars3.githubusercontent.com/u/3302806?v=4","gravatar_id":"","url":"https://api.github.com/users/scp-fs2open","html_url":"https://github.com/scp-fs2open","followers_url":"https://api.github.com/users/scp-fs2open/followers","following_url":"https://api.github.com/users/scp-fs2open/following{/other_user}","gists_url":"https://api.github.com/users/scp-fs2open/gists{/gist_id}","starred_url":"https://api.github.com/users/scp-fs2open/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scp-fs2open/subscriptions","organizations_url":"https://api.github.com/users/scp-fs2open/orgs","repos_url":"https://api.github.com/users/scp-fs2open/repos","events_url":"https://api.github.com/users/scp-fs2open/events{/privacy}","received_events_url":"https://api.github.com/users/scp-fs2open/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scp-fs2open/fs2open.github.com","description":"Origin Repository for SCP FreeSpace 2 Open","fork":false,"url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com","forks_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/forks","keys_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/teams","hooks_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/hooks","issue_events_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/events{/number}","events_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/events","assignees_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/assignees{/user}","branches_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/branches{/branch}","tags_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/tags","blobs_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/statuses/{sha}","languages_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/languages","stargazers_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/stargazers","contributors_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/contributors","subscribers_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/subscribers","subscription_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/subscription","commits_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/contents/{+path}","compare_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/merges","archive_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/downloads","issues_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues{/number}","pulls_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls{/number}","milestones_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/milestones{/number}","notifications_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/labels{/name}","releases_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/releases{/id}","deployments_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/deployments","created_at":"2013-01-19T06:10:53Z","updated_at":"2017-11-04T21:28:46Z","pushed_at":"2017-11-18T22:49:15Z","git_url":"git://github.com/scp-fs2open/fs2open.github.com.git","ssh_url":"git@github.com:scp-fs2open/fs2open.github.com.git","clone_url":"https://github.com/scp-fs2open/fs2open.github.com.git","svn_url":"https://github.com/scp-fs2open/fs2open.github.com","homepage":null,"size":128884,"stargazers_count":89,"watchers_count":89,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":70,"mirror_url":null,"archived":false,"open_issues_count":95,"forks":70,"open_issues":95,"watchers":89,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/1515"},"html":{"href":"https://github.com/scp-fs2open/fs2open.github.com/pull/1515"},"issue":{"href":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/1515"},"comments":{"href":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/1515/comments"},"review_comments":{"href":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/1515/comments"},"review_comment":{"href":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/1515/commits"},"statuses":{"href":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/statuses/e8ef727a199f00b44b0fe186e498bf5bbb823897"}},"author_association":"MEMBER","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"MageKing17","id":2095329,"avatar_url":"https://avatars2.githubusercontent.com/u/2095329?v=4","gravatar_id":"","url":"https://api.github.com/users/MageKing17","html_url":"https://github.com/MageKing17","followers_url":"https://api.github.com/users/MageKing17/followers","following_url":"https://api.github.com/users/MageKing17/following{/other_user}","gists_url":"https://api.github.com/users/MageKing17/gists{/gist_id}","starred_url":"https://api.github.com/users/MageKing17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MageKing17/subscriptions","organizations_url":"https://api.github.com/users/MageKing17/orgs","repos_url":"https://api.github.com/users/MageKing17/repos","events_url":"https://api.github.com/users/MageKing17/events{/privacy}","received_events_url":"https://api.github.com/users/MageKing17/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":1,"deletions":1,"changed_files":2}}
{"actor":{"display_login":"MageKing17"}}