fix main loop callback event lifetime issue