Skip to content

[114] Crash within WaylandWindowManager::GetCurrentPointerOrTouchFocusedWindow() #736

@russdill

Description

@russdill

A recent change within ui/ozone/platform/wayland/host/wayland_window_manager.cc, 5ae87c3476 "fixup! [ozone/wayland] Harden the logic that chooses the window being dragged" causes a crash if no input devices are available.

From 0fe409ca76554825fda818df1a015412bb0d9612 Mon Sep 17 00:00:00 2001
From: Russ Dill <russ.dill@nikolamotor.com>
Date: Tue, 18 Jul 2023 07:17:24 +0000
Subject: [PATCH 7/7] WaylandWindowManager: Protect access to drag_source()

window_drag_controller() may return a NULL result.

This crash was introduced by 5ae87c3476 "fixup!
[ozone/wayland] Harden the logic that chooses the
window being dragged"
---
 ui/ozone/platform/wayland/host/wayland_window_manager.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/ozone/platform/wayland/host/wayland_window_manager.cc b/ui/ozone/platform/wayland/host/wayland_window_manager.cc
index d65cc6e3a627d..5b910ec848fd1 100644
--- a/ui/ozone/platform/wayland/host/wayland_window_manager.cc
+++ b/ui/ozone/platform/wayland/host/wayland_window_manager.cc
@@ -101,6 +101,7 @@ WaylandWindow* WaylandWindowManager::GetCurrentPointerOrTouchFocusedWindow()
   //
   // TODO(https://crbug.com/1317063): Apply the same logic to data drag sessions
   // too?
+  if (connection_ && connection_->window_drag_controller())
   if (auto drag_source = connection_->window_drag_controller()->drag_source()) {
     return *drag_source == mojom::DragEventSource::kMouse
                ? GetCurrentPointerFocusedWindow()
-- 
2.34.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions