[ 
https://issues.apache.org/jira/browse/WEEX-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16597128#comment-16597128
 ] 

ASF GitHub Bot commented on WEEX-586:
-------------------------------------

YorkShen closed pull request #1488: [WEEX-586][Android] add synchronized for 
recycle list template layout
URL: https://github.com/apache/incubator-weex/pull/1488
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/AsynLayoutTask.java
 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/AsynLayoutTask.java
index 02a848659a..564c0586d5 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/AsynLayoutTask.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/binding/AsynLayoutTask.java
@@ -44,7 +44,12 @@
     protected Void doInBackground(Void... params) {
         if(templateViewHolder.getHolderPosition() == position){
             if(component.getInstance() != null && 
!component.getInstance().isDestroy()) {
-                Layouts.doLayoutOnly(component, templateViewHolder);
+                synchronized (templateViewHolder.getTemplateList()){
+                    if(templateViewHolder.getTemplateList().isDestoryed()){
+                        return null;
+                    }
+                    Layouts.doLayoutOnly(component, templateViewHolder);
+                }
             }
         }
         return null;
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
index ff56034fca..c6583d0389 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/template/WXRecyclerTemplateList.java
@@ -1291,36 +1291,37 @@ private void removeFooterOrHeader(WXComponent child) {
 
     @Override
     public void destroy() {
-
-        if(getHostView() != null){
-            if(mAppearChangeRunnable != null) {
-                getHostView().removeCallbacks(mAppearChangeRunnable);
-                mAppearChangeRunnable = null;
+        synchronized (this){
+            if(getHostView() != null){
+                if(mAppearChangeRunnable != null) {
+                    getHostView().removeCallbacks(mAppearChangeRunnable);
+                    mAppearChangeRunnable = null;
+                }
+                getHostView().removeCallbacks(listUpdateRunnable);
+                if(getHostView().getInnerView() != null){
+                    getHostView().getInnerView().setAdapter(null);
+                }
             }
-            getHostView().removeCallbacks(listUpdateRunnable);
-            if(getHostView().getInnerView() != null){
-                getHostView().getInnerView().setAdapter(null);
+            if(cellDataManager.listData != null){
+                cellDataManager.setListData(null);
             }
+            if(mStickyHelper != null){
+                mStickyHelper = null;
+            }
+            if(mTemplateViewTypes != null){
+                mTemplateViewTypes.clear();
+            }
+            if(mTemplateSources != null){
+                mTemplateSources.clear();
+            }
+            if(mAppearHelpers != null){
+                mAppearHelpers.clear();
+            }
+            if(mDisAppearWatchList != null){
+                mDisAppearWatchList.clear();
+            }
+            super.destroy();
         }
-        if(cellDataManager.listData != null){
-            cellDataManager.setListData(null);
-        }
-        if(mStickyHelper != null){
-            mStickyHelper = null;
-        }
-        if(mTemplateViewTypes != null){
-            mTemplateViewTypes.clear();
-        }
-        if(mTemplateSources != null){
-            mTemplateSources.clear();
-        }
-        if(mAppearHelpers != null){
-            mAppearHelpers.clear();
-        }
-        if(mDisAppearWatchList != null){
-            mDisAppearWatchList.clear();
-        }
-        super.destroy();
     }
 
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> WXEmbed Support Listen scroll scrollEnd scrollStart Event
> ---------------------------------------------------------
>
>                 Key: WEEX-586
>                 URL: https://issues.apache.org/jira/browse/WEEX-586
>             Project: Weex
>          Issue Type: Bug
>            Reporter: codefurture
>            Assignee: codefurture
>            Priority: Major
>
> WXEmbed Support Listen scroll scrollEnd scrollStart Event



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to