[osx] Fix crash when resizing a window while drawing