mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-02 23:35:29 +00:00
Fixed a problem where the ADL Main_Memory_Alloc callback delegate could be garbage collected while still in use.
This commit is contained in:
@@ -267,9 +267,11 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
|||||||
|
|
||||||
private delegate IntPtr ADL_Main_Memory_AllocDelegate(int size);
|
private delegate IntPtr ADL_Main_Memory_AllocDelegate(int size);
|
||||||
|
|
||||||
private static IntPtr Main_Memory_Alloc(int size) {
|
// create a Main_Memory_Alloc delegate and keep it alive
|
||||||
return Marshal.AllocHGlobal(size);;
|
private static ADL_Main_Memory_AllocDelegate Main_Memory_Alloc =
|
||||||
}
|
delegate(int size) {
|
||||||
|
return Marshal.AllocHGlobal(size);
|
||||||
|
};
|
||||||
|
|
||||||
private static void Main_Memory_Free(IntPtr buffer) {
|
private static void Main_Memory_Free(IntPtr buffer) {
|
||||||
if (IntPtr.Zero != buffer)
|
if (IntPtr.Zero != buffer)
|
||||||
|
Reference in New Issue
Block a user