use g_clear_object() for destroying gobjects.