Procházet zdrojové kódy

Fix segfault on DISP_CHANGE_RESTART

Fixes #647.
Camilla Berglund před 9 roky
rodič
revize
5668b64839
2 změnil soubory, kde provedl 10 přidání a 0 odebrání
  1. 2 0
      README.md
  2. 8 0
      src/win32_monitor.c

+ 2 - 0
README.md

@@ -75,6 +75,8 @@ used by the tests and examples and are not required to build the library.
  - Relaxed rules for native access header macros
  - Removed dependency on external OpenGL or OpenGL ES headers
  - [Win32] Added support for Windows 8.1 per-monitor DPI
+ - [Win32] Bugfix: Window creation would segfault if video mode setting required
+                   the system to be restarted
  - [Cocoa] Removed support for OS X 10.6
  - [Cocoa] Bugfix: Full screen windows on secondary monitors were mispositioned
  - [X11] Bugfix: Monitor connection and disconnection events were not reported

+ 8 - 0
src/win32_monitor.c

@@ -278,6 +278,14 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
         result[*count - 1] = mode;
     }
 
+    if (!*count)
+    {
+        // HACK: Report the current mode if no valid modes were found
+        result = calloc(1, sizeof(GLFWvidmode));
+        _glfwPlatformVideoMode(monitor, result);
+        *count = 1;
+    }
+
     return result;
 }