[NUI] Fix SVACE issues
authordongsug.song <dongsug.song@samsung.com>
Thu, 11 Jul 2024 04:46:10 +0000 (13:46 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 16 Jul 2024 06:26:45 +0000 (15:26 +0900)
src/Tizen.AIAvatar/src/Lipsync/VowelConverter/Audio2Vowel/inMFCC/Algorithm/FFT.cs
src/Tizen.AIAvatar/src/Lipsync/VowelConverter/Vowel2Animation/AnimationConverter.cs
src/Tizen.NUI/src/internal/Common/EnumHelper.cs
src/Tizen.NUI/src/internal/Widget/WidgetImpl.cs
src/Tizen.NUI/src/internal/Xaml/TypeConversionExtensions.cs
src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs
src/Tizen.NUI/src/public/Animation/Animation.cs
src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs
src/Tizen.NUI/src/public/CustomView/CustomViewRegistry.cs
src/Tizen.NUI/src/public/Input/FocusManager.cs
src/Tizen.NUI/src/public/XamlBinding/BindablePropertyConverter.cs

index 054f28f..b4399ea 100644 (file)
@@ -73,6 +73,7 @@ namespace Tizen.AIAvatar
                 im[i] = input[k++];
             }
 
+            fftSize = Math.Max(fftSize, 0);
             var L = fftSize;
             var M = fftSize >> 1;
             var S = fftSize - 1;
index 742368c..2e2c6a4 100644 (file)
@@ -69,6 +69,7 @@ namespace Tizen.AIAvatar
                                                            blendShapeCounts,
                                                            blendShapeKeyFormat);
                 _isInitialized = true;
+                v.Dispose();
             }
             catch (Exception)
             {
index 93f0508..7de41f9 100755 (executable)
@@ -37,7 +37,7 @@ namespace Tizen.NUI
         {
             string result = value.ToString();
             FieldInfo info = typeof(T).GetField(result);
-            var attributes = info.GetCustomAttributes(typeof(DescriptionAttribute), true);
+            var attributes = info?.GetCustomAttributes(typeof(DescriptionAttribute), true);
             if (null != attributes?.FirstOrDefault() && attributes?.First() as DescriptionAttribute is var firstAttribute && firstAttribute != null)
             {
                 result = firstAttribute.Description;
index 15e8ef7..719ec50 100755 (executable)
@@ -324,13 +324,17 @@ namespace Tizen.NUI
             swigDelegate6 = null;
             swigDelegate7 = null;
 
-            Interop.WidgetImpl.DirectorConnect(SwigCPtr,  null, null, null, null, null, null, null, null);
+            Interop.WidgetImpl.DirectorConnect(SwigCPtr, null, null, null, null, null, null, null, null);
         }
 
         private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes)
         {
             global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null);
-            bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(WidgetImpl));
+            bool hasDerivedMethod = false;
+            if (methodInfo != null)
+            {
+                hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(WidgetImpl));
+            }
             return hasDerivedMethod;
         }
 
index 2372031..b13df2c 100755 (executable)
@@ -250,7 +250,7 @@ namespace Tizen.NUI.Xaml
             }
 
             //if the value is not assignable and there's an implicit conversion, convert
-            if (value != null && !toType.IsAssignableFrom(value.GetType()))
+            if (value != null && toType!= null && !toType.IsAssignableFrom(value.GetType()))
             {
                 var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
                                 ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
index e82588c..7f52337 100755 (executable)
@@ -108,7 +108,7 @@ namespace Tizen.NUI.Xaml
             if (string.IsNullOrEmpty(xaml))
                 throw new XamlParseException(string.Format("No embeddedresource found for {0}", path), new XmlLineInfo());
             Type type = typeof(T);
-            T ret = (T)type.Assembly.CreateInstance(type.FullName);
+            T ret = (T)type.Assembly.CreateInstance(type.FullName) ?? default(T);
 
             NameScopeExtensions.PushElement(ret);
 
@@ -440,9 +440,10 @@ namespace Tizen.NUI.Xaml
         //part of the legacy as well...
         static string ReadResourceAsXaml(Type type, Assembly assembly, string likelyTargetName, bool validate = false)
         {
-            using (var stream = assembly.GetManifestResourceStream(likelyTargetName))
-            using (var reader = new StreamReader(stream))
+            using var stream = assembly.GetManifestResourceStream(likelyTargetName);
+            if (stream != null)
             {
+                using var reader = new StreamReader(stream);
                 if (validate)
                 {
                     // terrible validation of XML. Unfortunately it will probably work most of the time since comments
index 4993479..b8e4d32 100755 (executable)
@@ -1404,7 +1404,7 @@ namespace Tizen.NUI
             }
 
             //if the value is not assignable and there's an implicit conversion, convert
-            if (value != null && !toType.IsAssignableFrom(value.GetType()))
+            if (value != null && toType != null && !toType.IsAssignableFrom(value.GetType()))
             {
                 var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
                                  ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
index f726e98..14d4c48 100755 (executable)
@@ -237,7 +237,21 @@ namespace Tizen.NUI.BaseComponents
                 NUILog.Debug($"[AnimatedVectorImageView START[ [{GetId()}] RepeatCount SET");
 
                 repeatCnt = (value < -1) ? -1 : value;
-                LoopCount = (repeatCnt < 0) ? repeatCnt : repeatCnt + 1;
+                if (repeatCnt < 0)
+                {
+                    LoopCount = repeatCnt;
+                }
+                else
+                {
+                    if (repeatCnt < int.MaxValue)
+                    {
+                        LoopCount = repeatCnt + 1;
+                    }
+                    else
+                    {
+                        LoopCount = int.MaxValue;
+                    }
+                }
 
                 NUILog.Debug($"[{GetId()}] repeatCnt={repeatCnt} ]AnimatedVectorImageView END]");
             }
index 640f832..5062500 100755 (executable)
@@ -275,13 +275,11 @@ namespace Tizen.NUI
                     foreach (System.Attribute attr in attrs)
                     {
                         // If the Scriptable attribute exists, then register it with the type registry.
-                        if (attr is ScriptableProperty)
+                        // first get the attribute type, ( default, or animatable)
+                        if (attr is ScriptableProperty scriptableProp)
                         {
                             NUILog.Debug("Got a DALi JSON scriptable property = " + propertyInfo.Name + ", of type " + propertyInfo.PropertyType.Name);
 
-                            // first get the attribute type, ( default, or animatable)
-                            ScriptableProperty scriptableProp = attr as ScriptableProperty;
-
                             // we get the start property index, based on the type and it's hierarchy, e.g. DateView (70,000)-> Spin (60,000) -> View (50,000)
                             int propertyIndex = propertyRangeManager.GetPropertyIndex(viewType.ToString(), viewType, scriptableProp.type);
 
@@ -373,7 +371,7 @@ namespace Tizen.NUI
             if (view != null)
             {
                 // call the get property function
-                System.Object val = view.GetType().GetProperty(propertyName).GetAccessors()[0].Invoke(view, null);
+                System.Object val = view.GetType().GetProperty(propertyName)?.GetAccessors()[0].Invoke(view, null);
 
                 PropertyValue value = PropertyValue.CreateFromObject(val);
                 IntPtr ptr = (IntPtr)PropertyValue.getCPtr(value);
@@ -403,7 +401,7 @@ namespace Tizen.NUI
             {
                 System.Reflection.PropertyInfo propertyInfo = view.GetType().GetProperty(propertyName);
                 // We know the property name, we know it's type, we just need to convert from a DALi property value to native C# type
-                System.Type type = propertyInfo.PropertyType;
+                System.Type type = propertyInfo?.PropertyType;
                 bool ok = false;
 
                 if (type.Equals(typeof(Int32)))
index 59d5cc6..0f1c5d0 100755 (executable)
@@ -615,7 +615,7 @@ namespace Tizen.NUI
         {
             global::System.IntPtr cPtr = Interop.FocusManager.Get();
 
-            if(cPtr == global::System.IntPtr.Zero)
+            if (cPtr == global::System.IntPtr.Zero)
             {
                 NUILog.ErrorBacktrace("FocusManager.Instance called before Application created, or after Application terminated!");
             }
@@ -752,7 +752,7 @@ namespace Tizen.NUI
 
             focusChangingEventHandler?.Invoke(this, e);
 
-            if (originallyProposed != e.Proposed)
+            if (originallyProposed != e.Proposed && e.Proposed != null)
             {
                 //when user has changed Proposed
                 return e.Proposed.GetPtrfromView();
index 3e349f9..98a4d4c 100755 (executable)
@@ -110,7 +110,7 @@ namespace Tizen.NUI.Binding
                 return null;
             }
             Type type = Type.GetType("Tizen.NUI." + parts[0]);
-            return ConvertFrom(type, parts[1], null);
+            return type == null ? null : ConvertFrom(type, parts[1], null);
         }
 
         BindableProperty ConvertFrom(Type type, string propertyName, IXmlLineInfo lineinfo)