Skip to content

Commit

Permalink
[Tizen.Core] Fix managing native handle of Event (#6337)
Browse files Browse the repository at this point in the history
The native handle should not be null before calling Dispose() method.

Signed-off-by: Hwankyu Jhun <[email protected]>
  • Loading branch information
hjhun authored and bshsqa committed Sep 25, 2024
1 parent 118857b commit 590a9a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Tizen.Core/Tizen.Core/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void Emit(EventObject eventObject)
eventObject.Handle = IntPtr.Zero;
}

internal IntPtr Handle { get { return _handle; } set { _handle = value; } }
internal IntPtr Handle { get { return _handle; } }
internal IntPtr Source { get; set; }
internal int Id { get; set; }

Expand Down
3 changes: 1 addition & 2 deletions src/Tizen.Core/Tizen.Core/Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public void AddEvent(Event coreEvent)
throw new ArgumentNullException(nameof(coreEvent));
}

if (coreEvent.Handle == IntPtr.Zero)
if (coreEvent.Source != IntPtr.Zero)
{
throw new ArgumentException("The event is already added");
}
Expand All @@ -428,7 +428,6 @@ public void AddEvent(Event coreEvent)
}

coreEvent.Source = handle;
coreEvent.Handle = IntPtr.Zero;
}
}

Expand Down

0 comments on commit 590a9a8

Please sign in to comment.