Look in the DX docs (I'm assuming you're using DX 7.0) under "When Reference Counts Will Change" and "Reference Counts for Complex Surfaces", and "Releasing Surfaces". In short, I think if you just create the flipping chain using create surface, you can release the whole thing by just releasing the primary surface. However if you get access to the back buffer by using GetAttachedSurface (which you probably do, I dont know how else you can do it!), you have to release the back buffer explicitly because GetAttachedSurface increases its ref count.
I think setting them to NULL after the release is a good idea, but it would only find bugs from your own code trying to reuse the object.
One thing you might consider doing is watching the ref count of both surfaces as your program progresses and terminates - just write something like:
int refcount;
Surf->AddRef();
refcount = (int) Surf->Release();
This should give you the current reference count without actually changing it, and you can see what is actually going on.
Finally, IDirectDraw and IDirectDraw2 interfaces, when released, also release all their children, wheras later interfaces don't, but this shouldn't be a problem for you because you are releasing the DD object last (the problem was with releasing children after the parent)
Hope this helps a little
-ns
[This message has been edited by NightShade (edited December 23, 1999).]