Title: [112943] trunk/Tools
Revision
112943
Author
timothy_hor...@apple.com
Date
2012-04-02 14:23:38 -0700 (Mon, 02 Apr 2012)

Log Message

[mac] LayoutTestHelper crashes if there is no main display
https://bugs.webkit.org/show_bug.cgi?id=82944
<rdar://problem/11162954>

Reviewed by Simon Fraser.

If there's no main display attached, ColorSyncDeviceCopyDeviceInfo returns
a null dictionary, so we shouldn't go ahead and try to read from it.

* DumpRenderTree/mac/LayoutTestHelper.m:
(installLayoutTestColorProfile):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (112942 => 112943)


--- trunk/Tools/ChangeLog	2012-04-02 21:19:29 UTC (rev 112942)
+++ trunk/Tools/ChangeLog	2012-04-02 21:23:38 UTC (rev 112943)
@@ -1,3 +1,17 @@
+2012-04-02  Tim Horton  <timothy_hor...@apple.com>
+
+        [mac] LayoutTestHelper crashes if there is no main display
+        https://bugs.webkit.org/show_bug.cgi?id=82944
+        <rdar://problem/11162954>
+
+        Reviewed by Simon Fraser.
+
+        If there's no main display attached, ColorSyncDeviceCopyDeviceInfo returns
+        a null dictionary, so we shouldn't go ahead and try to read from it.
+
+        * DumpRenderTree/mac/LayoutTestHelper.m:
+        (installLayoutTestColorProfile):
+
 2012-04-02  Balazs Kelemen  <kbal...@webkit.org>
 
         [Qt][WK2] Set up plugin process on Unix

Modified: trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m (112942 => 112943)


--- trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m	2012-04-02 21:19:29 UTC (rev 112942)
+++ trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m	2012-04-02 21:23:38 UTC (rev 112943)
@@ -54,6 +54,13 @@
     
     if (!sUserColorProfileURL) {
         CFDictionaryRef deviceInfo = ColorSyncDeviceCopyDeviceInfo(kColorSyncDisplayDeviceClass, mainDisplayID);
+
+        if (!deviceInfo) {
+            NSLog(@"No display attached to system; not setting main display's color profile.");
+            CFRelease(mainDisplayID);
+            return;
+        }
+
         CFDictionaryRef profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncCustomProfiles);
         if (profileInfo) {
             sUserColorProfileURL = (CFURLRef)CFDictionaryGetValue(profileInfo, CFSTR("1"));
@@ -83,7 +90,7 @@
     CFDictionarySetValue(profileInfo, kColorSyncDeviceDefaultProfileID, profileURL);
     
     if (!ColorSyncDeviceSetCustomProfiles(kColorSyncDisplayDeviceClass, mainDisplayID, profileInfo)) {
-        fprintf(stderr, "Failed to set color profile for main display! Many pixel tests may fail as a result.\n");
+        NSLog(@"Failed to set color profile for main display! Many pixel tests may fail as a result.");
         
         if (sUserColorProfileURL) {
             CFRelease(sUserColorProfileURL);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to