to add priority in RegisterDestroyWindowFunc