From 50d1ccc156fc4308e7d05d8ec7dd035ca5d95369 Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Tue, 8 Dec 2020 09:34:45 -0800 Subject: [PATCH] Made respondsToPointerEvents() more resilient to execution off-EDT by only calling isScrollable() if it is running on the EDT. This is because isScrollable may trigger some mutations from the UI while it determines if the component is scrollable. This likely fixes the issue that https://github.com/codenameone/CodenameOne/pull/3323 is meant to address. --- CodenameOne/src/com/codename1/ui/Component.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CodenameOne/src/com/codename1/ui/Component.java b/CodenameOne/src/com/codename1/ui/Component.java index 82a49df021..894df64015 100644 --- a/CodenameOne/src/com/codename1/ui/Component.java +++ b/CodenameOne/src/com/codename1/ui/Component.java @@ -4299,7 +4299,8 @@ public void addPullToRefresh(Runnable task){ * @return True if the pointer responds to pointer events. */ public boolean respondsToPointerEvents() { - return isVisible() && isEnabled() && (isScrollable() || isFocusable() || isGrabsPointerEvents() || isDraggable()); + boolean isScrollable = CN.isEdt() ? isScrollable() : (scrollableXFlag() || scrollableYFlag()); + return isVisible() && isEnabled() && (isScrollable || isFocusable() || isGrabsPointerEvents() || isDraggable()); } private boolean pointerReleaseMaterialPullToRefresh() {