Textures aren't drawn after UAC popup

Hello, I’ve created a simple SDL2 application which draws a 8 by 8 texture on the screen. The problem I’m having is that if I launch another program which loads the UAC popup or if I lock my PC and then login again, the application stops drawing the texture. I tried adding SDL_Delay(10000) after SDL_RenderPresent(renderer). This made the texture stay on the screen for a little bit but the texture wasn’t drawn again after the delay. Here’s my code:

Code:
#include <SDL.h>
#include <SDL_image.h>

int main(int argc, char *argv[])
{
bool enable_vsync = 1;

if(SDL_Init(SDL_INIT_VIDEO) < 0) return 1;

SDL_Window *window;
window = SDL_CreateWindow("SDL2 Application", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 600, SDL_WINDOW_RESIZABLE);

SDL_Renderer *renderer;
renderer = SDL_CreateRenderer(window, -1, enable_vsync ? SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC : SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(renderer, 20, 20, 30, 255);

SDL_Texture *rect_texture;
rect_texture = IMG_LoadTexture(renderer, "rect.bmp");

SDL_Event *main_event;
main_event = new SDL_Event();

SDL_Rect rect_data;
rect_data.w = 8; rect_data.h = 8;
rect_data.x = 300; rect_data.y = 300;

while(main_event->type != SDL_QUIT)
{
    SDL_PollEvent(main_event);

    SDL_RenderClear(renderer);
    SDL_RenderCopy(renderer, rect_texture, NULL, &rect_data);
    SDL_RenderPresent(renderer);
}

SDL_DestroyTexture(rect_texture);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();

return 0;

}

I can’t see anything wrong in the code so I’m quite confused. Thanks![/code]

Resizing the window after the texture has disappeared seems to reset the window and the texture is drawn again.

Good clue, thanks!

This is fixed in the latest SDL snapshot:
http://www.libsdl.org/tmp/SDL-2.0.zip

Cheers!On Mon, Aug 5, 2013 at 9:56 PM, Sythical <soul_reaper_121 at hotmail.com>wrote:

**
Resizing the window after the texture has disappeared seems to reset the
window and the texture is drawn again.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org