Commit c570ae00 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

[XProto] Crash early in OzonePlatformX11 if X connection is down

This is a speculative fix for bug 1137614 possibly introduced by
e552c103.  The issue is the change from
    CHECK(gfx::GetXDisplay())
to
	CHECK(x11::Connection::Get())
The second call will always succeed since x11::Connection::Get() always
returns something even if the underlying connection is down.  But the
intention was to hit the CHECK() in this case, as that's what the
behavior was before (gfx::GetXDisplay() returns nullptr when the
connection failed).  This CL restores the old behvaior by explicitly
checking the connection state.

R=msisov

Bug: 1137614
Change-Id: If2b2049e39b4d892e60fd29813c915459787d8d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2558716
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Maksim Sisov (GMT+2) <msisov@igalia.com>
Reviewed-by: default avatarMaksim Sisov (GMT+2) <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#830895}
parent 41a6b0a2
...@@ -270,7 +270,7 @@ class OzonePlatformX11 : public OzonePlatform, ...@@ -270,7 +270,7 @@ class OzonePlatformX11 : public OzonePlatform,
// If opening the connection failed there is nothing we can do. Crash here // If opening the connection failed there is nothing we can do. Crash here
// instead of crashing later. If you are crashing here, make sure there is // instead of crashing later. If you are crashing here, make sure there is
// an X server running and $DISPLAY is set. // an X server running and $DISPLAY is set.
CHECK(x11::Connection::Get()) << "Missing X server or $DISPLAY"; CHECK(x11::Connection::Get()->Ready()) << "Missing X server or $DISPLAY";
common_initialized_ = true; common_initialized_ = true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment