MacOS : EXC_BAD_ACCESS in main, ONLY when creating windows with SDL_WINDOW_FULLSCREEN_DESKTOP -- EDIT : resolved ! Bug in SDL!

I recently upgraded to 2.0.9 and get a crash every time… So I created a very simple dummy project with which I can reproduce this 100% of the time :frowning:

this is all I do :

	SDL_Renderer* renderer;
	SDL_Init( SDL_INIT_EVERYTHING );
	
	SDL_Window *window;
	
	int dialog_w = 640;
	int dialog_h = 480;
	
	window = SDL_CreateWindow("test",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,dialog_w,dialog_h,SDL_WINDOW_FULLSCREEN_DESKTOP|SDL_WINDOW_SHOWN|SDL_WINDOW_BORDERLESS);
	renderer = SDL_CreateRenderer(window, -1, 0);
	
	
	SDL_Delay(2500);
	SDL_DestroyRenderer(renderer);
	SDL_Delay(2500);
	SDL_DestroyWindow(window);
	SDL_Delay(2500);
	SDL_Quit(); 

sample project is here : https://we.tl/t-RE6gr9wAT9

does anyone have any idea ? If I replace the flag SDL_WINDOW_FULLSCREEN_DESKTOP with SDL_WINDOW_FULLSCREEN, it runs fine !

running on Mojave with latest XCode

I was wondering : could this be related to the “codedesign” issues found online (this is a self-built version of SDL)

replying to self : I found the cause ! With the new fix for the Mojave black screen at startup, a lot of calls are being made to ScheduleContextUpdates(SDL_WindowData *data), but that function DOES NOT CHECK if data is actually valid !!!

the following 2 lines after { below will fix the crash :

    ScheduleContextUpdates(SDL_WindowData *data)
    {
            if (!data)
                    return;

as a side note : the black-screen problem of Mojave is NOT FIXED when running windowed mode ! Only in fullscreen is it fixed

Please report this issue, along with your proposed fix, at https://bugzilla.libsdl.org
so that it won’t get lost.

i will try… have never done anything like that :stuck_out_tongue: