Curiosity at hardware surface access violation

Hi all,

I’ve just written and run a small program using VC++6 and SDL. My program does
the following (not code as it is quite long!):

Initialise SDL
Request screen dimensions and colour depth via console
Create a surface from SDL

Blank out the surface
Get lots more user parameters via console
Blit to the screen
Get feedback from the user as to whether they like the bitmap
while (user doesn’t like bitmap)

Save bitmap
Close down SDL and quit

If the user doesn’t like the bitmap, it runs through the loop again. However, if
they grab the console window and move it over the top, the second loop gets an
access violation trying to access the screen buffer (a hardware surface). Is
this access violation because the window has been hidden, or some other reason?