You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by na...@apache.org on 2014/10/09 22:22:49 UTC

[17/19] git commit: CB-6837 Fix leaked window when hitting back button while alert being rendered

CB-6837 Fix leaked window when hitting back button while alert being rendered

Keep track of the last AlertDialog showed.
The last dialog showed that is rendered while hitting back button it
causes a leaked window.
Instead of perform a full track of all dialogs created, only destroy the
last one showed, this fixes the problem.

close #122

Conflicts:

	framework/src/org/apache/cordova/CordovaChromeClient.java


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/346f53dc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/346f53dc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/346f53dc

Branch: refs/heads/master
Commit: 346f53dc338765e6f5f28fb8b1d5f173a51d3e16
Parents: 5c27334
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Oct 3 00:47:13 2014 -0500
Committer: Prabhjot Singh <pr...@amazon.com>
Committed: Mon Oct 6 19:15:48 2014 +0530

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaChromeClient.java  | 15 ++++++++++++---
 framework/src/org/apache/cordova/CordovaWebView.java |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/346f53dc/framework/src/org/apache/cordova/CordovaChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaChromeClient.java b/framework/src/org/apache/cordova/CordovaChromeClient.java
index 73a765f..7ae7996 100755
--- a/framework/src/org/apache/cordova/CordovaChromeClient.java
+++ b/framework/src/org/apache/cordova/CordovaChromeClient.java
@@ -71,6 +71,9 @@ public class CordovaChromeClient extends AmazonWebChromeClient {
     // the video progress view
     private View mVideoProgressView;
     
+    //Keep track of last AlertDialog showed
+    private AlertDialog lastHandledDialog;
+    
     // File Chooser
     public AmazonValueCallback<Uri> mUploadMessage;
     
@@ -121,7 +124,7 @@ public class CordovaChromeClient extends AmazonWebChromeClient {
                         result.cancel();
                     }
                 });
-        dlg.show();
+        lastHandledDialog = dlg.show();
         return true;
     }
 
@@ -162,7 +165,7 @@ public class CordovaChromeClient extends AmazonWebChromeClient {
                         result.cancel();
                     }
                 });
-        dlg.show();
+        lastHandledDialog = dlg.show();
         return true;
     }
 
@@ -207,7 +210,7 @@ public class CordovaChromeClient extends AmazonWebChromeClient {
                             res.cancel();
                         }
                     });
-            dlg.show();
+            lastHandledDialog = dlg.show();
         }
         return true;
     }
@@ -374,4 +377,10 @@ public class CordovaChromeClient extends AmazonWebChromeClient {
         }
         return null;
     }
+    public void destroyLastDialog(){
+        if(lastHandledDialog != null){
+                lastHandledDialog.cancel();
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/346f53dc/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index c749bd0..c2749db 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -915,6 +915,9 @@ public class CordovaWebView extends AmazonWebView {
 
         // Load blank page so that JavaScript onunload is called
         this.loadUrl("about:blank");
+        
+        //Remove last AlertDialog
+        this.chromeClient.destroyLastDialog();
 
         // Forward to plugins
         if (this.pluginManager != null) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org