From: huayong.xu Date: Sun, 29 Jan 2023 02:44:23 +0000 (+0800) Subject: [NUI] Fix some SVACE issues. X-Git-Tag: submit/tizen/20230201.082803~1^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=828fb8b1618b53e8293331e93b7d3cf215b0d17d;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Fix some SVACE issues. --- diff --git a/src/Tizen.NUI/src/public/Common/PropertyNotification.cs b/src/Tizen.NUI/src/public/Common/PropertyNotification.cs index c87966232..1511c684b 100755 --- a/src/Tizen.NUI/src/public/Common/PropertyNotification.cs +++ b/src/Tizen.NUI/src/public/Common/PropertyNotification.cs @@ -285,26 +285,32 @@ namespace Tizen.NUI { if (propertyNotificationNotifyEventHandler != null) { - var process = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var process = global::System.Diagnostics.Process.GetCurrentProcess(); + var processId = process.Id; var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId; var me = this.GetType().FullName; Tizen.Log.Error("NUI", $"Error! NUI's native dali object is already disposed. " + $"OR the native dali object handle of NUI becomes null! \n" + - $" process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + $" process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + + process.Dispose(); } } else { if (this.IsDisposeQueued) { - var process = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var process = global::System.Diagnostics.Process.GetCurrentProcess(); + var processId = process.Id; var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId; var me = this.GetType().FullName; //in this case, this object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! Tizen.Log.Error("NUI", "in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! just return here! \n" + - $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + $"process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + + process.Dispose(); return; } } diff --git a/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs b/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs index f705010c6..7659110e9 100755 --- a/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs +++ b/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs @@ -593,26 +593,32 @@ namespace Tizen.NUI { if (detectedEventHandler != null) { - var process = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var process = global::System.Diagnostics.Process.GetCurrentProcess(); + var processId = process.Id; var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId; var me = this.GetType().FullName; Tizen.Log.Error("NUI", $"Error! NUI's native dali object is already disposed. " + $"OR the native dali object handle of NUI becomes null! \n" + - $" process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + $" process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + + process.Dispose(); } } else { if (this.IsDisposeQueued) { - var process = global::System.Diagnostics.Process.GetCurrentProcess().Id; + var process = global::System.Diagnostics.Process.GetCurrentProcess(); + var processId = process.Id; var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId; var me = this.GetType().FullName; //in this case, this object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! Tizen.Log.Error("NUI", "in this case, the View object is ready to be disposed waiting on DisposeQueue, so event callback should not be invoked! just return here! \n" + - $"process:{process} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + $"process:{processId} thread:{thread}, isDisposed:{this.Disposed}, isDisposeQueued:{this.IsDisposeQueued}, me:{me}\n"); + + process.Dispose(); return; } } diff --git a/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs b/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs index 523275d73..12ee8ed1c 100755 --- a/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs +++ b/src/Tizen.NUI/src/public/Xaml/StaticResourceExtension.cs @@ -98,19 +98,23 @@ namespace Tizen.NUI.Xaml && resource.GetType().GetTypeInfo().IsGenericType && (resource.GetType().GetGenericTypeDefinition() == typeof(OnPlatform<>))) { - var tType = resource.GetType().GenericTypeArguments[0]; - var opImplicit = tType.GetImplicitConversionOperator(fromType: tType, toType: propertyType) - ?? propertyType.GetImplicitConversionOperator(fromType: tType, toType: propertyType); - - if (opImplicit != null) + var typeArgs = resource.GetType().GenericTypeArguments; + if (typeArgs != null) { - //convert the OnPlatform to T - var opPlatformImplicitConversionOperator = resource?.GetType().GetImplicitConversionOperator(fromType: resource?.GetType(), toType: tType); - resource = opPlatformImplicitConversionOperator?.Invoke(null, new[] { resource }); + var tType = typeArgs[0]; + var opImplicit = tType.GetImplicitConversionOperator(fromType: tType, toType: propertyType) + ?? propertyType.GetImplicitConversionOperator(fromType: tType, toType: propertyType); + + if (opImplicit != null) + { + //convert the OnPlatform to T + var opPlatformImplicitConversionOperator = resource?.GetType().GetImplicitConversionOperator(fromType: resource?.GetType(), toType: tType); + resource = opPlatformImplicitConversionOperator?.Invoke(null, new[] { resource }); - //and convert to toType - resource = opImplicit.Invoke(null, new[] { resource }); - return resource; + //and convert to toType + resource = opImplicit.Invoke(null, new[] { resource }); + return resource; + } } } }