The code you have there should work properly.
Is it located in the main gameloop, like for example in the ontimer event?

If you haven't and you perform a resize, it'll clear the main surface, like you're describing in your post.