Make it ineligible for garbage collection for delegate (#4948)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Wed, 1 Feb 2023 02:58:23 +0000 (11:58 +0900)
committerGitHub <noreply@github.com>
Wed, 1 Feb 2023 02:58:23 +0000 (11:58 +0900)
This patch is to prevent the delegate garbage collected.

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs

index 7a3d44f..aa63d9d 100644 (file)
@@ -98,6 +98,7 @@ namespace Tizen.Applications
             };
 
             Interop.Bundle.Foreach(_handle, iterator, IntPtr.Zero);
+            GC.KeepAlive(iterator);
             if ((BundleErrorFactory.BundleError)ErrorFacts.GetLastResult() == BundleErrorFactory.BundleError.InvalidParameter)
             {
                 throw new ArgumentException("Invalid parameter - cannot create bundle instance");