Fixing SVACE handle leaks in tray and null deref check in Apps 91/282391/1
authorshivamv <shivam.v2@samsung.com>
Fri, 30 Sep 2022 11:21:59 +0000 (16:51 +0530)
committershivamv <shivam.v2@samsung.com>
Fri, 30 Sep 2022 11:21:59 +0000 (16:51 +0530)
Change-Id: I089a2c99aecb4b5e8d350489b3a04960fc9ff844
Signed-off-by: shivamv <shivam.v2@samsung.com>
Apps/Models/AppInfoModel.cs
Apps/ViewModels/AppInfoViewModel.cs
TrayApplication/Models/AppInfoModel.cs
packaging/org.tizen.Apps-1.0.0.tpk
packaging/org.tizen.TrayApplication-1.0.0.tpk

index e7a301a2106f37b93be9b724985fc55c33d431c1..fa487dfd9c5ff2451899d3ca19d6656e1dfe9d75 100755 (executable)
@@ -35,16 +35,16 @@ namespace Apps.Models
             set => SetProperty(ref iconBackground, value);
         }
 
-        private void SetDefaultBackground()
+        private ImageVisual GetDefaultImageVisual()
         {
             ImageVisual imageVisual = new ImageVisual()
             {
                 URL = Resources.GetImagePath() + "default_gradient.png",
             };
-            IconBackground = imageVisual.OutputVisualMap;
+            return imageVisual;
         }
 
-        private void SetGradientBackground(PropertyArray stopColor)
+        private GradientVisual GetGradientVisual(PropertyArray stopColor)
         {
             GradientVisual gradientVisual = new GradientVisual()
             {
@@ -53,7 +53,7 @@ namespace Apps.Models
                 StopColor = stopColor,
                 SpreadMethod = GradientVisualSpreadMethodType.Pad,
             };
-            IconBackground = gradientVisual.OutputVisualMap;
+            return gradientVisual;
         }
 
         private PropertyArray GetGradientStopColors(Palette palette)
@@ -124,12 +124,12 @@ namespace Apps.Models
             if (stopColor.Count() < 2)
             {
                 Tizen.Log.Info(Resources.LogTag, "Palette or palatte values not valid, adding default gradient");
-                SetDefaultBackground();
+                IconBackground = GetDefaultImageVisual().OutputVisualMap;
             }
             else
             {
-                Tizen.Log.Info(Resources.LogTag, "setting palette color");
-                SetGradientBackground(stopColor);
+                Tizen.Log.Info(Resources.LogTag, "setting palette color");\r
+                IconBackground = GetGradientVisual(stopColor).OutputVisualMap;
             }
         }
     }
index 797cac0de606a357b21c6b2a050ee7e66b8a6645..0958e09b2b8436a5d5700e3b4f203677b03e027a 100755 (executable)
@@ -16,9 +16,13 @@ namespace Apps.ViewModels
         public void CreateData(IEnumerable<ApplicationInfo> list)
         {
             Clear();
+            if(list == null)\r
+            {\r
+                return;\r
+            }
             foreach (ApplicationInfo appInfo in list)
             {
-                if (string.IsNullOrEmpty(appInfo.IconPath))
+                if (appInfo == null || string.IsNullOrEmpty(appInfo.IconPath))
                 {
                     continue;
                 }
index 13d917c0d02a025969de5627598fef5b626d69c9..4d57ab97f0c8e0cc5e1c8070f2f04856fb9b0dfe 100755 (executable)
@@ -55,6 +55,7 @@ namespace TrayApplication.Models
                 URL = Resources.GetImagePath() + "default_gradient.png",
             };
             IconBackground = imageVisual.OutputVisualMap;
+            imageVisual.Dispose();
         }
 
         private void SetGradientBackground(PropertyArray stopColor)
@@ -67,6 +68,7 @@ namespace TrayApplication.Models
                 SpreadMethod = GradientVisualSpreadMethodType.Pad,
             };
             IconBackground = gradientVisual.OutputVisualMap;
+            gradientVisual.Dispose();
         }
 
         private PropertyArray GetGradientStopColors(Palette palette)
index 14a309b09973d17bffbebe35f70b39c90c6368c3..58bcbd4306ad2e9c8a4831213191e106819bd58a 100755 (executable)
Binary files a/packaging/org.tizen.Apps-1.0.0.tpk and b/packaging/org.tizen.Apps-1.0.0.tpk differ
index 7282e547ee87136060249963008b80b5b1bceff5..9effc77fc68fd29c934654d22c5630fe5ec9d46e 100755 (executable)
Binary files a/packaging/org.tizen.TrayApplication-1.0.0.tpk and b/packaging/org.tizen.TrayApplication-1.0.0.tpk differ