From 8dad483a2495b175de2a7f9ac6ebec0f7f44de6b Mon Sep 17 00:00:00 2001 From: lixianjing Date: Mon, 20 Mar 2023 18:37:08 +0800 Subject: [PATCH] improve double click --- docs/changes.md | 3 +++ src/base/input_device_status.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changes.md b/docs/changes.md index 37120d46b..2f54d7f11 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -1,5 +1,8 @@ # 最新动态 +2023/03/20 + * 修复分发double_clicked事件时存在的野指针风险(感谢雨欣提供补丁) + 2023/03/16 * 完善JSON((感谢俊杰提供补丁) diff --git a/src/base/input_device_status.c b/src/base/input_device_status.c index 5b0f9d339..06ca269df 100644 --- a/src/base/input_device_status.c +++ b/src/base/input_device_status.c @@ -345,9 +345,10 @@ static ret_t input_device_status_dispatch_input_event(input_device_status_t* ids if (delta_time < TK_DOUBLE_CLICK_TIME && tk_abs(delta_x) < TK_DOUBLE_CLICK_XY && tk_abs(delta_y) < TK_DOUBLE_CLICK_XY) { + event_t* d_evt; pointer_event_t double_click; - e = pointer_event_init(&double_click, EVT_DOUBLE_CLICK, widget, evt->x, evt->y); - widget_dispatch_event_to_target_recursive(widget, e); + d_evt = pointer_event_init(&double_click, EVT_DOUBLE_CLICK, widget, evt->x, evt->y); + widget_dispatch_event_to_target_recursive(widget, d_evt); log_debug("double clicked\n"); }