From cc7f0bd532067b6259dfe8195a4150a178986818 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 7 Nov 2013 16:20:52 +0100 Subject: [PATCH] Fixed crash retrieving the name of some displays. --- README.md | 1 + src/cocoa_monitor.m | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 848bc303..729f74da 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ guide in the GLFW documentation. - [Cocoa] Bugfix: Full screen windows were never reported as having focus - [Cocoa] Bugfix: A superfluous I/O flag test prevented video modes from being listed for Thunderbolt monitor + - [Cocoa] Bugfix: Retrieving the name of some external displays caused segfault - [X11] Added setting of the `WM_CLASS` property to the initial window title - [X11] Bugfix: Removed joystick axis value negation left over from GLFW 2 - [X11] Bugfix: The position of hidden windows was ignored by Metacity diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index 504a5fc9..caddde40 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -49,9 +49,11 @@ static const char* getDisplayName(CGDirectDisplayID displayID) kIODisplayOnlyPreferredName); names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName)); - if (!CFDictionaryGetValueIfPresent(names, CFSTR("en_US"), - (const void**) &value)) + if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"), + (const void**) &value)) { + _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name"); + CFRelease(info); return strdup("Unknown"); }