Fixed a problem where the ADL Main_Memory_Alloc callback delegate could be garbage collected while still in use.

This commit is contained in:
Michael Möller
2010-09-27 23:48:41 +00:00
parent e94f1c5874
commit 7232dcc55f

View File

@@ -267,9 +267,11 @@ namespace OpenHardwareMonitor.Hardware.ATI {
private delegate IntPtr ADL_Main_Memory_AllocDelegate(int size);
private static IntPtr Main_Memory_Alloc(int size) {
return Marshal.AllocHGlobal(size);;
}
// create a Main_Memory_Alloc delegate and keep it alive
private static ADL_Main_Memory_AllocDelegate Main_Memory_Alloc =
delegate(int size) {
return Marshal.AllocHGlobal(size);
};
private static void Main_Memory_Free(IntPtr buffer) {
if (IntPtr.Zero != buffer)