Commit 671be629 by Geoff Lang Committed by Commit Bot

Make sure the DisplayImpl is terminated if it fails to fully initialize.

It is possible that if device creation fails that the display would be left in a state where rx::DisplayImpl is initialized and egl::Display is not. BUG=angleproject:2546 Change-Id: I609e4c40f37945322d64786d4f6e97f361764b62 Reviewed-on: https://chromium-review.googlesource.com/1066501 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 534b00db
...@@ -499,7 +499,14 @@ Error Display::initialize() ...@@ -499,7 +499,14 @@ Error Display::initialize()
{ {
std::unique_ptr<rx::DeviceImpl> impl(mImplementation->createDevice()); std::unique_ptr<rx::DeviceImpl> impl(mImplementation->createDevice());
ASSERT(impl != nullptr); ASSERT(impl != nullptr);
ANGLE_TRY(impl->initialize()); error = impl->initialize();
if (error.isError())
{
ERR() << "Failed to initialize display because device creation failed: "
<< error.getMessage();
mImplementation->terminate();
return error;
}
mDevice = new Device(this, impl.release()); mDevice = new Device(this, impl.release());
} }
else else
......
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