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

[PackageManager] Fix garbage collected delegate problem #6293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ilho159kim
Copy link
Contributor

Description of Change

SizeInfoCallback delegate can be collected by the garbage collector before receiving size info result

API Changes

N/A

@github-actions github-actions bot added the API12 Platform : Tizen 9.0 / TFM: net6.0-tizen9.0 label Aug 28, 2024
@@ -46,8 +46,8 @@ public class Package
private List<string> _privileges;
private int _installedTime;

private Dictionary<IntPtr, Interop.PackageManager.PackageManagerSizeInfoCallback> _packageManagerSizeInfoCallbackDict = new Dictionary<IntPtr, Interop.PackageManager.PackageManagerSizeInfoCallback>();
private int _callbackId = 0;
private static Dictionary<IntPtr, Interop.PackageManager.PackageManagerSizeInfoCallback> _packageManagerSizeInfoCallbackDict = new Dictionary<IntPtr, Interop.PackageManager.PackageManagerSizeInfoCallback>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use ConcurrentDictionary instead of Dictionary for thread safe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ignore this comment.
The implementation already used lock for thread safe.

@hjhun hjhun requested a review from pjh9216 August 29, 2024 02:05
SizeInfoCallback delegate can be collected by the garbage collector
before receiving size info result

Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API12 Platform : Tizen 9.0 / TFM: net6.0-tizen9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants