From d5dbddafdcba3ef2904fa7a283c27039927dd755 Mon Sep 17 00:00:00 2001 From: "s89.jang" Date: Mon, 20 Mar 2017 16:33:38 +0900 Subject: Fix a static analyzer issue Use using statement to call Dispose() properly. Change-Id: Iafc78925819f0c40f45ee8d23cf8b891d3c9c718 Signed-off-by: s89.jang --- .../Tizen.Applications/ApplicationManager.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'Tizen.Applications.Common') diff --git a/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs b/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs index 1644e16..ea2dd74 100644 --- a/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs +++ b/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs @@ -329,14 +329,16 @@ namespace Tizen.Applications { throw ApplicationManagerErrorFactory.GetException(err, "Failed to register the application context event."); } - ApplicationRunningContext context = new ApplicationRunningContext(clonedHandle); - if (state == Interop.ApplicationManager.AppContextEvent.Launched) + using (ApplicationRunningContext context = new ApplicationRunningContext(clonedHandle)) { - s_launchedHandler?.Invoke(null, new ApplicationLaunchedEventArgs { ApplicationRunningContext = context }); - } - else if (state == Interop.ApplicationManager.AppContextEvent.Terminated) - { - s_terminatedHandler?.Invoke(null, new ApplicationTerminatedEventArgs { ApplicationRunningContext = context }); + if (state == Interop.ApplicationManager.AppContextEvent.Launched) + { + s_launchedHandler?.Invoke(null, new ApplicationLaunchedEventArgs { ApplicationRunningContext = context }); + } + else if (state == Interop.ApplicationManager.AppContextEvent.Terminated) + { + s_terminatedHandler?.Invoke(null, new ApplicationTerminatedEventArgs { ApplicationRunningContext = context }); + } } }; err = Interop.ApplicationManager.AppManagerSetAppContextEvent(s_applicationChangedEventCallback, IntPtr.Zero); -- cgit v1.2.3