Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI][API10] Do not register events if disposed ImagView changed #5357

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,9 +1189,9 @@
// Update corner radius properties to image by ActionUpdateProperty
if (backgroundExtraData.CornerRadius != null)
{
Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, ImageView.Property.IMAGE, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));

Check warning on line 1192 in src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

View workflow job for this annotation

GitHub Actions / build

ApplyCornerRadius calls InternalUpdateVisualPropertyVector4 but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
}
Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, ImageView.Property.IMAGE, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);

Check warning on line 1194 in src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

View workflow job for this annotation

GitHub Actions / build

ApplyCornerRadius calls InternalUpdateVisualPropertyInt but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
}

internal override void ApplyBorderline()
Expand All @@ -1202,9 +1202,9 @@


// Update borderline properties to image by ActionUpdateProperty
Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, ImageView.Property.IMAGE, Visual.Property.BorderlineWidth, backgroundExtraData.BorderlineWidth);

Check warning on line 1205 in src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

View workflow job for this annotation

GitHub Actions / build

ApplyBorderline calls InternalUpdateVisualPropertyFloat but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, ImageView.Property.IMAGE, Visual.Property.BorderlineColor, Vector4.getCPtr(backgroundExtraData.BorderlineColor ?? Color.Black));

Check warning on line 1206 in src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

View workflow job for this annotation

GitHub Actions / build

ApplyBorderline calls InternalUpdateVisualPropertyVector4 but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, ImageView.Property.IMAGE, Visual.Property.BorderlineOffset, backgroundExtraData.BorderlineOffset);

Check warning on line 1207 in src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

View workflow job for this annotation

GitHub Actions / build

ApplyBorderline calls InternalUpdateVisualPropertyFloat but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
}

internal ResourceLoadingStatusType GetResourceStatus()
Expand Down Expand Up @@ -1315,7 +1315,7 @@
if(_border != value)
{
_border = new Rectangle(value);
UpdateImage(NpatchImageVisualProperty.Border, new PropertyValue(_border));

Check warning on line 1318 in src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

View workflow job for this annotation

GitHub Actions / build

Call System.IDisposable.Dispose on object created by 'new PropertyValue(_border)' before all references to it are out of scope.
}
}

Expand Down Expand Up @@ -1383,10 +1383,21 @@
// 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();
}
}
}
}
Expand Down Expand Up @@ -1631,7 +1642,7 @@
/// Event arguments of resource ready.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public class ResourceReadyEventArgs : EventArgs

Check warning on line 1645 in src/Tizen.NUI/src/public/BaseComponents/ImageView.cs

View workflow job for this annotation

GitHub Actions / build

Do not nest type ResourceReadyEventArgs. Alternatively, change its accessibility so that it is not externally visible.
{
private View _view;

Expand Down
Loading