{"action":"created","issue":{"url":"https://api.github.com/repos/CorsixTH/CorsixTH/issues/1029","repository_url":"https://api.github.com/repos/CorsixTH/CorsixTH","labels_url":"https://api.github.com/repos/CorsixTH/CorsixTH/issues/1029/labels{/name}","comments_url":"https://api.github.com/repos/CorsixTH/CorsixTH/issues/1029/comments","events_url":"https://api.github.com/repos/CorsixTH/CorsixTH/issues/1029/events","html_url":"https://github.com/CorsixTH/CorsixTH/issues/1029","id":145834158,"number":1029,"title":"Minimising then opening program causes nullptr exception","user":{"login":"antibones","id":1817032,"avatar_url":"https://avatars.githubusercontent.com/u/1817032?v=3","gravatar_id":"","url":"https://api.github.com/users/antibones","html_url":"https://github.com/antibones","followers_url":"https://api.github.com/users/antibones/followers","following_url":"https://api.github.com/users/antibones/following{/other_user}","gists_url":"https://api.github.com/users/antibones/gists{/gist_id}","starred_url":"https://api.github.com/users/antibones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antibones/subscriptions","organizations_url":"https://api.github.com/users/antibones/orgs","repos_url":"https://api.github.com/users/antibones/repos","events_url":"https://api.github.com/users/antibones/events{/privacy}","received_events_url":"https://api.github.com/users/antibones/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/CorsixTH/CorsixTH/labels/Component-SDL2","name":"Component-SDL2","color":"bfe5bf"},{"url":"https://api.github.com/repos/CorsixTH/CorsixTH/labels/Type-Game%20Crash","name":"Type-Game Crash","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-04T23:38:45Z","updated_at":"2016-04-05T12:51:06Z","closed_at":null,"body":"#### Describe the issue\r\nWith resolutions greater or equal to the monitor resolution if you go from full screen to windowed, or minimize then restore the game the game crashes with a null pointer exception.\r\n\r\nThe error thrown is:\r\n`texture was nullptr` \r\n\r\nThe stack trace when this happens is below:\r\n\r\n\t`SDL2.dll!D3D_RecreateTextureRep(IDirect3DDevice9` * device, D3D_TextureRep * texture, unsigned int format, int w, int h) Line 886\tC\r\n\r\n \tSDL2.dll!D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) Line 1007\tC\r\n\r\n \tSDL2.dll!D3D_Reset(SDL_Renderer * renderer) Line 421\tC\r\n\r\n \tSDL2.dll!D3D_ActivateRenderer(SDL_Renderer * renderer) Line 486\tC\r\n\r\n \tSDL2.dll!D3D_RenderClear(SDL_Renderer * renderer) Line 1296\tC\r\n\r\n \tCorsixTH.exe!THRenderTarget::fillBlack() Line 437\tC++\r\n\r\n \tCorsixTH.exe!THRenderTarget::startFrame() Line 409\tC++\r\n\r\n \tCorsixTH.exe!l_surface_start_frame(lua_State * L) Line 638\tC++\r\n\r\n \tlua53.dll!00007ffa6871c2ea()\tUnknown\r\n\r\n \tlua53.dll!00007ffa68734aca()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871ce1a()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871cbca()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871c5e5()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871c933()\tUnknown\r\n\r\n \tCorsixTH.exe!luaT_resume(lua_State * L, lua_State * f, int n) Line 118\tC++\r\n\r\n \tCorsixTH.exe!l_mainloop(lua_State * L) Line 287\tC++\r\n\r\n \tlua53.dll!00007ffa6871c2ea()\tUnknown\r\n\r\n \tlua53.dll!00007ffa68734aca()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871be14()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871118b()\tUnknown\r\n\r\n \tCorsixTH.exe!CorsixTH_lua_main(lua_State * L) Line 180\tC++\r\n\r\n \tlua53.dll!00007ffa6871c2ea()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871be08()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871c5e5()\tUnknown\r\n\r\n \tlua53.dll!00007ffa6871c030()\tUnknown\r\n\r\n \tlua53.dll!00007ffa68712444()\tUnknown\r\n\r\n \tCorsixTH.exe!SDL_main(int argc, char * * argv) Line 98\tC++\r\n\r\n \tCorsixTH.exe!invoke_main() Line 75\tC++\r\n\r\n \tCorsixTH.exe!__scrt_common_main_seh() Line 264\tC++\r\n\r\n \tCorsixTH.exe!__scrt_common_main() Line 309\tC++\r\n\r\n \tCorsixTH.exe!mainCRTStartup() Line 17\tC++\r\n\r\n \tkernel32.dll!00007ffa8f5c8102()\tUnknown\r\n\r\n \tntdll.dll!00007ffa9183c5b4()\tUnknown`\r\n\r\n#### Steps to Reproduce\r\n1. Open the game and go to main menu\r\n\r\n2. Set resolution equal to monitor resolution or greater\r\n\r\n3. Alternate between windowed and full screen using the toggle option in menus\r\n\r\n#### Save Game\r\nN/A\r\n\r\n#### Expected Behavior\r\nCanvas should refresh without crashing\r\n\r\n#### System Information\r\n**CorsixTH Version:**  85d890f \r\n\r\n**Operating System:** Windows 10 x64\r\n\r\n**Graphics card:** ATI 7850\r\n**Driver:** 2016.0321.1015.16463\r\n\r\n**Theme Hospital Version:** CD\r\n\r\n### Additional Info\r\n\r\nWalking through the stack trace with SDL symbols imported the nullptr first appears when SDL tries to recreate the texture by calling D3D_RecreateTexture which relies on _m_pRenderer_. \r\nThe driverdata member of the SDL_renderer pointer _m_pRenderer_ is null which is then passed to D3D_RecreateTextureRep who tries to access it and fails.\r\nI am not familiar with SDL so I could not establish if this is a bug within the library or with how m_pRenderer is being set\r\n"},"comment":{"url":"https://api.github.com/repos/CorsixTH/CorsixTH/issues/comments/205785774","html_url":"https://github.com/CorsixTH/CorsixTH/issues/1029#issuecomment-205785774","issue_url":"https://api.github.com/repos/CorsixTH/CorsixTH/issues/1029","id":205785774,"user":{"login":"TheCycoONE","id":823433,"avatar_url":"https://avatars.githubusercontent.com/u/823433?v=3","gravatar_id":"","url":"https://api.github.com/users/TheCycoONE","html_url":"https://github.com/TheCycoONE","followers_url":"https://api.github.com/users/TheCycoONE/followers","following_url":"https://api.github.com/users/TheCycoONE/following{/other_user}","gists_url":"https://api.github.com/users/TheCycoONE/gists{/gist_id}","starred_url":"https://api.github.com/users/TheCycoONE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheCycoONE/subscriptions","organizations_url":"https://api.github.com/users/TheCycoONE/orgs","repos_url":"https://api.github.com/users/TheCycoONE/repos","events_url":"https://api.github.com/users/TheCycoONE/events{/privacy}","received_events_url":"https://api.github.com/users/TheCycoONE/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T12:51:05Z","updated_at":"2016-04-05T12:51:05Z","body":"Just a couple extra things to help classify the issue before we investigate:\r\nThis is a custom build, which version of SDL2 were you using (or if you were using CorsixTH/deps, which commit).\r\nDoes the same problem happen in the 0.50 release?"}}