[NUI][API10] Do not register events if disposed ImagView changed
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 26 Jun 2023 05:21:57 +0000 (14:21 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Tue, 27 Jun 2023 00:55:48 +0000 (09:55 +0900)
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

index 5bf0fd2..00c22dc 100755 (executable)
@@ -1383,10 +1383,21 @@ namespace Tizen.NUI.BaseComponents
                 // Lazy update only if _resourceUrl is not empty and ProcessAttachedFlag is false.
                 if (!string.IsNullOrEmpty(_resourceUrl) && !imagePropertyUpdateProcessAttachedFlag)
                 {
-                    imagePropertyUpdateProcessAttachedFlag = true;
-                    ProcessorController.Instance.ProcessorOnceEvent += UpdateImage;
-                    // Call process hardly.
-                    ProcessorController.Instance.Awake();
+                    if(!HasBody())
+                    {
+                        // Throw exception if ImageView is disposed.
+                        // For legacy code safety, do not throw exception. and just print log for API10 now.
+                        //throw new global::System.InvalidOperationException("[NUI][ImageVIew] Someone try to change disposed ImageView's property.\n");
+
+                        Tizen.Log.Error("NUI", "[NUI][ImageVIew] Someone try to change disposed ImageView's property.\n");
+                    }
+                    else
+                    {
+                        imagePropertyUpdateProcessAttachedFlag = true;
+                        ProcessorController.Instance.ProcessorOnceEvent += UpdateImage;
+                        // Call process hardly.
+                        ProcessorController.Instance.Awake();
+                    }
                 }
             }
         }