Fix segfault: gtk_get_current_event can return null

fix segfault when gtk_get_current_event return null
fix memory leak: gtk_get_current_event return value must be freed