summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs6
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs5
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs1
3 files changed, 11 insertions, 1 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index a77f36ddb..cdb368c9a 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -348,6 +348,12 @@ namespace HandBrake.Interop
bitmap.UnlockBits(bitmapData);
+ // Close the image so we don't leak memory.
+ IntPtr nativeJobPtrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
+ Marshal.WriteIntPtr(nativeJobPtrPtr, resultingImageStuct);
+ HBFunctions.hb_image_close(nativeJobPtrPtr);
+ Marshal.FreeHGlobal(nativeJobPtrPtr);
+
// Create a Bitmap Image for display.
using (var memoryStream = new MemoryStream())
{
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
index 2b1e4a770..8721784e8 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
@@ -452,6 +452,11 @@ namespace HandBrake.Interop.HbLib
[DllImport("hb.dll", EntryPoint = "hb_get_preview2", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_get_preview2(IntPtr hbHandle, int title_idx, int preview_idx, ref hb_geometry_settings_s geo, int deinterlace);
+ // void hb_image_close(hb_image_t **_image);
+ [DllImport("hb.dll", EntryPoint = "hb_image_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_image_close(IntPtr image);
+
+
/* JSON API */
// char * hb_get_title_set_json(hb_handle_t * h);
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs
index 598fedac1..97809c348 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs
@@ -107,6 +107,5 @@ namespace HandBrake.Interop.Json.Factories
};
return geometry;
}
-
}
}