Commit 5e55fd6a authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

[ozone/wayland] Do not add window if manager does not exist

It may happen that the zwp linux dmabuf protocol is not available.
In this case, we have already been resetting the gbm device and
make the gpu use wl_egl instead, but the WaylandConnection still
has been trying to add a window to the WaylandBufferManager upon
creation. However, as previously said, the manager may not exist
because the zwp linux dmabuf had not been advertised as supported
protocol.

Without this patch, it just crashes.

Bug: 578890
Change-Id: I15bcd7ae968590d358a4590d79a54067de02e8d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1609822Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#659405}
parent fc0e425d
......@@ -160,8 +160,10 @@ WaylandWindow* WaylandConnection::GetCurrentKeyboardFocusedWindow() const {
void WaylandConnection::AddWindow(gfx::AcceleratedWidget widget,
WaylandWindow* window) {
DCHECK(buffer_manager_);
buffer_manager_->OnWindowAdded(window);
if (buffer_manager_) {
DCHECK(zwp_dmabuf_);
buffer_manager_->OnWindowAdded(window);
}
window_map_[widget] = window;
}
......@@ -170,8 +172,8 @@ void WaylandConnection::RemoveWindow(gfx::AcceleratedWidget widget) {
if (touch_)
touch_->RemoveTouchPoints(window_map_[widget]);
DCHECK(buffer_manager_);
buffer_manager_->OnWindowRemoved(window_map_[widget]);
if (buffer_manager_)
buffer_manager_->OnWindowRemoved(window_map_[widget]);
window_map_.erase(widget);
}
......
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