GitHub user martincgg opened a pull request:
https://github.com/apache/cordova-android/pull/123
[CB-6837][Android 4.0.x branch] Fix: leaked window when hitting back button
while alert being rendered
CB-6837
It is basically:
https://github.com/apache/cordova-android/pull/122
Only this is refactored for 4.0.x branch.
Description:
Created arrayList on AndroidChromeClient that it will register all showed
AlertDialog, using AndroidChromeClient class, this applies to AlertDialogs
object, included messages, prompts and confirm AlertDialog objects.
When handleDestroy() method is called on the AndroidWebView, it will
perform a call to AndroidChromeClient class to destroy all AlerDialogs objects
registered on the arrayList.
This would perform a cleanup before the CordovaActivity is destroyed.
dlg.show() returns an AlertDialog object, to be added to the arrayList.
It can be:
dialogsManager.add(dlg.show());
But I think it looks cleaner as currently is.
Tested on 4.4.2.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/martincgg/cordova-android CB-6837_4.0.x
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-android/pull/123.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #123
----
commit a582fe9c9e5f7118647dceb7ed6103a976febbc6
Author: Martin Gonzalez <[email protected]>
Date: 2014-09-22T20:24:47Z
[CB-6837][Android 4.0.x] Fix: leaked window when hitting back button while
alert being rendered
Created arrayList on ChromeClient that it will register all showed
AlertDialog, using CordovaChromeClient class, this applies to
AlertDialogs object, included messages, prompts and confirm AlertDialog
objects.
When handleDestroy() method is called on the CordovaWebView, it will
perform a call to ChromeClient class to destroy all AlerDialogs objects
registered on the arrayList.
This would perform a cleanup before the CordovaActivity is destroyed.
dlg.show() returns an AlertDialog object, to be added to the arrayList.
It can be:
dialogsManager.add(dlg.show());
But I think it looks cleaner as currently is.
Tested on 4.2.2 & 4.4.2.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---