Fix memory leaked caused by Marshal.GetFunctionPointerForDelegate (#28074) accepted/tizen_6.0_unified tizen_6.0 accepted/tizen/6.0/unified/20210115.041837 accepted/tizen/unified/20210115.125752 submit/tizen/20210115.013305 submit/tizen_6.0/20210115.013248
authorAaron Robinson <arobins@microsoft.com>
Tue, 11 Aug 2020 23:52:55 +0000 (19:52 -0400)
committer조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Fri, 15 Jan 2021 01:30:24 +0000 (10:30 +0900)
src/vm/dllimportcallback.cpp
src/vm/dllimportcallback.h

index b5a4c9c..8c49709 100644 (file)
@@ -961,11 +961,18 @@ void UMEntryThunk::Terminate()
     CONTRACTL
     {
         NOTHROW;
+        MODE_ANY;
     }
     CONTRACTL_END;
 
     m_code.Poison();
 
+    if (GetObjectHandle())
+    {
+        DestroyLongWeakHandle(GetObjectHandle());
+        m_pObjectHandle = 0;
+    }
+
     s_thunkFreeList.AddToList(this);
 }
 
index 3d93d32..03be244 100644 (file)
@@ -310,22 +310,6 @@ public:
 #endif
     }
 
-    ~UMEntryThunk()
-    {
-        CONTRACTL
-        {
-            NOTHROW;
-            GC_NOTRIGGER;
-            MODE_ANY;
-        }
-        CONTRACTL_END;
-
-        if (GetObjectHandle())
-        {
-            DestroyLongWeakHandle(GetObjectHandle());
-        }
-    }
-
     void Terminate();
 
     VOID RunTimeInit()