Ctrl-alt-del during overlay crashes (windows)

I’m trying to recover my video overlay surface after ctrl-alt-del is pressed.
The problem is that I’m writing directly to the raw surface pointer.
A ctrl-alt-del switches to the SAS desktop, which destroys the overlay on the user desktop.
The pointer to the overlay surface pixels (my_overlay->pixels[0]) remains the same value though.

Is there any way I can detect that the pointer is no longer pointing to a valid surface?

I tried to Create a new surface at various SDL_Events, but no luck there so far.

if (SDL_mutexP(m_sdlmutex) == 0)
{
SDL_LockYUVOverlay(my_overlay);
LPBYTE pSurf = (LPBYTE) my_overlay->pixels[0];
int x = 0, y = 0;
Uint16 lPitch = my_overlay->pitches[0];;

    LPBYTE pWork 	= m_lpMyVideoData;

    Uint16 dwBytesInRow = my_overlay->w*2;

    for(y=0; y<m_nDataHeight; y++)
    {
        for (x=0; x<m_nDataWidth;x++)
        {
            *(pSurf++) = *(pWork++);
            *(pSurf++) = *(pWork++);
        }
        pSurf+=(lPitch-dwBytesInRow);
    }
 //---SNIP--- 
 ...

}

Basically I need a way to validate the ‘my_overlay->pixels[0]’ pointer. Any ideas?

Davy

SDL_LockYUVOverlay() returns 0 on success, or -1 on an error. You
should definitely be checking the return value before using the
surface pointer, and may find it returns failure when the surface
isn’t available.

SiOn Tue, 22 Feb 2005 14:02:08 +0100, Vandekerckhove Davy <D.Vandekerckhove at televic.com> wrote:

Basically I need a way to validate the ‘my_overlay->pixels[0]’ pointer. Any ideas?

<D.Vandekerckhove at televic.com> wrote:

Basically I need a way to validate the ‘my_overlay->pixels[0]’ pointer. Any ideas?

SDL_LockYUVOverlay() returns 0 on success, or -1 on an error. You
should definitely be checking the return value before using the
surface pointer, and may find it returns failure when the surface
isn’t available.

This works perfectly. thx._______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl