[PATCH] util: avoid race in releasing the GSource in event thread