Skip to content

Commit

Permalink
[NUI] Make DaliAccessibilityDetachAccessibleObject called at main thread
Browse files Browse the repository at this point in the history
void Dispose(bool) can be called from worker thread, when disposing value is false.

To ensure we detach AccessibileObject in main thread, let we remove it
at Dispose(DisposeTypes), instead of Dispose(bool).

To avoid this kind of error in future, let we remove View.Dispose(bool)
and let we only use Dispose(DisposeTypes).

Signed-off-by: Eunki, Hong <[email protected]>
  • Loading branch information
Eunki, Hong authored and dongsug-song committed Nov 2, 2023
1 parent 5346d34 commit 4436f80
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ protected override void Dispose(DisposeTypes type)
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void Dispose(bool disposing)
{
// Note : We can clean dictionaries even this API called from GC Thread.
CleanCallbackDictionaries();
base.Dispose(disposing);
}
Expand Down
31 changes: 0 additions & 31 deletions src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,37 +367,6 @@ public void UnregisterDefaultLabel()
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

[EditorBrowsable(EditorBrowsableState.Never)]
protected override void Dispose(bool disposing)
{
if (disposed)
{
return;
}

internalName = null;

Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();

if (disposing == false)
{
if (IsNativeHandleInvalid() || SwigCMemOwn == false)
{
// at this case, implicit nor explicit dispose is not required. No native object is made.
disposed = true;
return;
}
}

if (disposing)
{
Unparent();
}

base.Dispose(disposing);
}

[EditorBrowsable(EditorBrowsableState.Never)]
protected static readonly string AccessibilityActivateAction = "activate";
[EditorBrowsable(EditorBrowsableState.Never)]
Expand Down
7 changes: 6 additions & 1 deletion src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,12 @@ protected override void Dispose(DisposeTypes type)

disposeDebugging(type);

internalName = "";
Unparent();

Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();

//_mergedStyle = null;

internalMaximumSize?.Dispose();
Expand Down Expand Up @@ -1273,7 +1279,6 @@ protected override void Dispose(DisposeTypes type)
rotationGestureDetector?.Dispose();
rotationGestureDetector = null;


internalCurrentParentOrigin?.Dispose();
internalCurrentParentOrigin = null;
internalCurrentAnchorPoint?.Dispose();
Expand Down

0 comments on commit 4436f80

Please sign in to comment.