Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E576B11FBF for ; Tue, 17 Jun 2014 18:06:27 +0000 (UTC) Received: (qmail 17437 invoked by uid 500); 17 Jun 2014 18:06:27 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 17412 invoked by uid 500); 17 Jun 2014 18:06:27 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 17403 invoked by uid 99); 17 Jun 2014 18:06:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jun 2014 18:06:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8B2B0980DC8; Tue, 17 Jun 2014 18:06:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Message-Id: <8093a3a263764134a13653fb44a3a759@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: CB-6924 Fixed memory leak in WP page navigation Date: Tue, 17 Jun 2014 18:06:27 +0000 (UTC) Repository: cordova-wp8 Updated Branches: refs/heads/master 829beb988 -> 0c5f0e393 CB-6924 Fixed memory leak in WP page navigation Occurred when navigating back and forth from native to hybrid page. Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/0c5f0e39 Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/0c5f0e39 Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/0c5f0e39 Branch: refs/heads/master Commit: 0c5f0e393db026633afd89fec0684c0021d19df6 Parents: 829beb9 Author: Staci Cooper Authored: Tue Jun 17 13:43:54 2014 -0400 Committer: Staci Cooper Committed: Tue Jun 17 13:43:54 2014 -0400 ---------------------------------------------------------------------- wp8/template/cordovalib/ConsoleHelper.cs | 9 +++++++++ wp8/template/cordovalib/CordovaView.xaml.cs | 10 ++++++++++ 2 files changed, 19 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/0c5f0e39/wp8/template/cordovalib/ConsoleHelper.cs ---------------------------------------------------------------------- diff --git a/wp8/template/cordovalib/ConsoleHelper.cs b/wp8/template/cordovalib/ConsoleHelper.cs index cf79d23..3443821 100644 --- a/wp8/template/cordovalib/ConsoleHelper.cs +++ b/wp8/template/cordovalib/ConsoleHelper.cs @@ -71,6 +71,15 @@ namespace WPCordovaClassLib.CordovaLib } } + public void DetachHandler() + { + if (hasListener) + { + PhoneApplicationService.Current.Closing -= OnServiceClosing; + hasListener = false; + } + } + public bool HandleCommand(string commandStr) { string output = commandStr.Substring("ConsoleLog/".Length); http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/0c5f0e39/wp8/template/cordovalib/CordovaView.xaml.cs ---------------------------------------------------------------------- diff --git a/wp8/template/cordovalib/CordovaView.xaml.cs b/wp8/template/cordovalib/CordovaView.xaml.cs index 1872a91..0514aa6 100644 --- a/wp8/template/cordovalib/CordovaView.xaml.cs +++ b/wp8/template/cordovalib/CordovaView.xaml.cs @@ -513,7 +513,17 @@ namespace WPCordovaClassLib private void CordovaBrowser_Unloaded(object sender, RoutedEventArgs e) { + IBrowserDecorator console; + if (browserDecorators.TryGetValue("ConsoleLog", out console)) + { + ((ConsoleHelper)console).DetachHandler(); + } + PhoneApplicationService service = PhoneApplicationService.Current; + service.Activated -= new EventHandler(AppActivated); + service.Launching -= new EventHandler(AppLaunching); + service.Deactivated -= new EventHandler(AppDeactivated); + service.Closing -= new EventHandler(AppClosing); } private void CordovaBrowser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e)