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

Commit

Permalink
Fix the crash that happens when touch device is re-enabled.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yejingfu authored and kalyankondapally committed Oct 17, 2014
1 parent 53f8552 commit 55b2036
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions wayland/input/pointer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ namespace ozonewayland {
WaylandPointer::WaylandPointer()
: cursor_(NULL),
dispatcher_(NULL),
pointer_position_(0, 0) {
pointer_position_(0, 0),
input_pointer_(NULL) {
}

WaylandPointer::~WaylandPointer() {
delete cursor_;
if (input_pointer_)
wl_pointer_destroy(input_pointer_);
}

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

if ((caps & WL_SEAT_CAPABILITY_POINTER) && !cursor_->GetInputPointer()) {
wl_pointer* input_pointer = wl_seat_get_pointer(seat);
cursor_->SetInputPointer(input_pointer);
wl_pointer_set_user_data(input_pointer, this);
wl_pointer_add_listener(input_pointer, &kInputPointerListener, this);
input_pointer_ = wl_seat_get_pointer(seat);
cursor_->SetInputPointer(input_pointer_);
wl_pointer_set_user_data(input_pointer_, this);
wl_pointer_add_listener(input_pointer_, &kInputPointerListener, this);
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER)
&& cursor_->GetInputPointer()) {
cursor_->SetInputPointer(NULL);
Expand Down
1 change: 1 addition & 0 deletions wayland/input/pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class WaylandPointer {
// dispatch this with events such as wheel or button which don't have a
// position associated on Wayland.
gfx::Point pointer_position_;
struct wl_pointer *input_pointer_;

DISALLOW_COPY_AND_ASSIGN(WaylandPointer);
};
Expand Down

0 comments on commit 55b2036

Please sign in to comment.