Coronal ejection and heating in variable X-ray sources