Mac: fix crash when creating a new window