From c43de7334b4a27bedaff39c8093b99950f08040e Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Mon, 26 Jun 2023 14:21:57 +0900 Subject: [PATCH] [NUI][API10] Do not register events if disposed ImagView changed Signed-off-by: Eunki, Hong --- src/Tizen.NUI/src/public/BaseComponents/ImageView.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 5bf0fd2..00c22dc 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -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(); + } } } } -- 2.7.4