Electrooptical compensation for self-heating in CD*A during second-harmonic generation