I googled
"In emergencies, the X-wing's Guidenhauser ejection seat can throw the pilot clear of the fighter. Separator charges blast the cockpit canopy free, and also launch the astromech unit from the socket"
http://www.starwars.com/databank/starship/xwing/
and what happens to a human in space
http://www.howstuffworks.com/question540.htm