Commit 094655cff99949b8a511339636f88ebfac7142ac

Ryan C. Gordon 2020-02-23T14:49:03

cocoa: Make sure wait for button enable can't be infinite.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 15dd14c..79e1b9d 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -876,7 +876,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
     button = [nswindow standardWindowButton:NSWindowMiniaturizeButton];
     if (button) {
         int iterations = 0;
-        while (![button isEnabled]) {
+        while (![button isEnabled] && (iterations < 100)) {
             SDL_Delay(10);
             SDL_PumpEvents();
             iterations++;