Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit 55b2036

Browse files
yejingfukalyankondapally
yejingfu
authored andcommitted
Fix the crash that happens when touch device is re-enabled.
This is part of previous changes. We need to call wl_pointer_destroy to release the wl_pointer device when pointer(mouse) device is disabled. BUT=TC-1729
1 parent 53f8552 commit 55b2036

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

wayland/input/pointer.cc

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ namespace ozonewayland {
1717
WaylandPointer::WaylandPointer()
1818
: cursor_(NULL),
1919
dispatcher_(NULL),
20-
pointer_position_(0, 0) {
20+
pointer_position_(0, 0),
21+
input_pointer_(NULL) {
2122
}
2223

2324
WaylandPointer::~WaylandPointer() {
2425
delete cursor_;
26+
if (input_pointer_)
27+
wl_pointer_destroy(input_pointer_);
2528
}
2629

2730
void WaylandPointer::OnSeatCapabilities(wl_seat *seat, uint32_t caps) {
@@ -39,10 +42,10 @@ void WaylandPointer::OnSeatCapabilities(wl_seat *seat, uint32_t caps) {
3942
dispatcher_ = ui::EventFactoryOzoneWayland::GetInstance()->EventConverter();
4043

4144
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !cursor_->GetInputPointer()) {
42-
wl_pointer* input_pointer = wl_seat_get_pointer(seat);
43-
cursor_->SetInputPointer(input_pointer);
44-
wl_pointer_set_user_data(input_pointer, this);
45-
wl_pointer_add_listener(input_pointer, &kInputPointerListener, this);
45+
input_pointer_ = wl_seat_get_pointer(seat);
46+
cursor_->SetInputPointer(input_pointer_);
47+
wl_pointer_set_user_data(input_pointer_, this);
48+
wl_pointer_add_listener(input_pointer_, &kInputPointerListener, this);
4649
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER)
4750
&& cursor_->GetInputPointer()) {
4851
cursor_->SetInputPointer(NULL);

wayland/input/pointer.h

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class WaylandPointer {
6868
// dispatch this with events such as wheel or button which don't have a
6969
// position associated on Wayland.
7070
gfx::Point pointer_position_;
71+
struct wl_pointer *input_pointer_;
7172

7273
DISALLOW_COPY_AND_ASSIGN(WaylandPointer);
7374
};

0 commit comments

Comments
 (0)