浏览代码

Fix segfault on DISP_CHANGE_RESTART

Fixes #647.
Camilla Berglund 9 年之前
父节点
当前提交
5668b64839
共有 2 个文件被更改,包括 10 次插入0 次删除
  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;
 }