Hi David, Call Cleanup() from right after where you call ServerProcessLoop(), not from within any of your StorageReflectSession methods. The reason is that Cleanup() will delete the StorageReflectSession object, and so when Cleanup() returns, the StorageReflectSession object's "this" pointer will be dangling, and so you get a crash. Jeremy > Actually the EndServer( ) call doesn't work so nice that I'd thought. > > switch ( msg->what ) > { > case NB=5FCOMMAND=5FSTOP=5FSERVER: > { > Cleanup( ); > EndServer( ); > break; > } > ... > > If I'm not calling Cleanup( ) MUSCLE will be very angry and say that I > probably hasn't called Cleanup( ). This will result in a lot of LogTime's > and a segmentation fault. So I added Cleanup( ) ...but... > > On RH9 (linux,g++,pthreads) the application exits with the "Killed" message > to the std output. It is strange - it is just if I had issued "kill -9 pid"! > > On Windows (msvc,win32) the application crashes with "Unhandled > exception..." at line 1007 in storagereflectsession.cpp. > > What am I missing in order to stop the server correctly=3F > > /D