Screen freeze minimised -> maximised

I have a simple SDL application with a re-sizeable window, if I minimise then maximise the window the rendering freezes. If I “window” the window the rendering starts again fine, and if I go from windowed to maximised it renders fine as well. I’ve included a simple code example below which makes the screen flash through varying shades of grey. Try minimising, then maximising, then windowing… How do I stop the rendering freezing when going from minimised to maximised?

I’m currently running SDL2.0 v 2.0.3 on Windows 10 machine (experienced the same problem running on previous Windows 7 machine).

I posted similar query on SDL Development group but got no response, sorry for re-posting but I’m a bit desperate… Thanks

//Demonstrates screen freeze when you minimise then maximise the screen....

#include "SDL.h"

using namespace std;

int main( int argc, char* args[] )
    //Initialise SDL2, declare Window + Renderer
    SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ); //Initialize SDL for video and audio
    SDL_Window* pWindow = NULL;
    SDL_Renderer* pRenderer = NULL;
    pWindow = SDL_CreateWindow("Minimise Maximise Test", 50, 50, 1200, 600, SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED);
    pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_TARGETTEXTURE);

    //The Screen colour which is going to flash through different shades of grey
    SDL_Color screenColour = {0, 0, 0};

    //SDL event for detecting X-out (quit)
    SDL_Event event;
    bool quit = false;

    while( quit == false )   //While SDL has not been X'ed out
        ////Handle quit
        if (SDL_PollEvent(&event) != 0)
            if(event.type == SDL_QUIT) quit = true; //Press X-out to quit (but not visible on fullscreen)

        //Make screen flash by changing its colour through shades of grey

        //Render the screen
        SDL_SetRenderDrawColor(pRenderer, screenColour.r, screenColour.g, screenColour.b, 255);
        SDL_RenderFillRect(pRenderer, NULL);
        SDL_RenderPresent(pRenderer); //like SDL_flip

    return 0;

Fixed by upgrading to SDL2 v 2.0.4. This was a bug in previous SDL2 versions (I had been using 2.0.3…). After re-linking your project don’t forget to copy new SDL2.dll into your project directory (like I did) or it won’t work!