From: hjhun <36876573+hjhun@users.noreply.github.com> Date: Fri, 6 Nov 2020 05:57:02 +0000 (+0900) Subject: Fix static analysis issues (#2193) X-Git-Tag: submit/tizen_6.0/20201107.005230~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f1afc4d82d04be8351371c22cfc3e0cd4ce4e15;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Fix static analysis issues (#2193) Issues: - NO_LOCK.STAT Signed-off-by: Hwankyu Jhun --- diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs index 85f0785..64969c7 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs @@ -447,13 +447,16 @@ namespace Tizen.Applications } using (ApplicationRunningContext context = new ApplicationRunningContext(clonedHandle)) { - if (state == Interop.ApplicationManager.AppContextEvent.Launched) + lock (s_applicationChangedEventLock) { - 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 }); + } } } }; @@ -488,13 +491,16 @@ namespace Tizen.Applications s_eventCallback = (string appType, string appId, Interop.ApplicationManager.AppManagerEventType eventType, Interop.ApplicationManager.AppManagerEventState eventState, IntPtr eventHandle, IntPtr UserData) => { - if (eventType == Interop.ApplicationManager.AppManagerEventType.Enable) - { - s_enabledHandler?.Invoke(null, new ApplicationEnabledEventArgs(appId, (ApplicationEventState)eventState)); - } - else if (eventType == Interop.ApplicationManager.AppManagerEventType.Disable) + lock (s_eventLock) { - s_disabledHandler?.Invoke(null, new ApplicationDisabledEventArgs(appId, (ApplicationEventState)eventState)); + if (eventType == Interop.ApplicationManager.AppManagerEventType.Enable) + { + s_enabledHandler?.Invoke(null, new ApplicationEnabledEventArgs(appId, (ApplicationEventState)eventState)); + } + else if (eventType == Interop.ApplicationManager.AppManagerEventType.Disable) + { + s_disabledHandler?.Invoke(null, new ApplicationDisabledEventArgs(appId, (ApplicationEventState)eventState)); + } } }; err = Interop.ApplicationManager.AppManagerSetEventCallback(_eventHandle, s_eventCallback, IntPtr.Zero);