mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 23:55:26 +00:00
Fix crashes in Gdk.Pixbuf.Savev
Patch from Bertrand Lorentz <bertrand.lorentz@gmail.com> * gdk/Gdk.metadata: hide gdk_pixbuf_savev * gdk/Pixbuf.custom: manually implement Savev to NullTerm the string[] parameters. [Fixes #681111]
This commit is contained in:
parent
1752fca097
commit
571bd01356
|
@ -61,7 +61,7 @@
|
||||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='GetFormats']" name="hidden">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='GetFormats']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='GetPixels']" name="hidden">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='GetPixels']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Save']" name="hidden">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Save']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Savev']/*/*[@type='char**']" name="array">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Savev']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBuffer']" name="hidden">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBuffer']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBufferv']" name="hidden">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBufferv']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToCallback']" name="hidden">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToCallback']" name="hidden">1</attr>
|
||||||
|
|
|
@ -303,3 +303,23 @@
|
||||||
throw new GLib.GException (error);
|
throw new GLib.GException (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("libgdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
static extern unsafe bool gdk_pixbuf_savev(IntPtr raw, IntPtr filename, IntPtr type, IntPtr[] option_keys, IntPtr[] option_values, out IntPtr error);
|
||||||
|
|
||||||
|
public unsafe bool Savev(string filename, string type, string[] option_keys, string[] option_values) {
|
||||||
|
IntPtr error = IntPtr.Zero;
|
||||||
|
IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup (filename);
|
||||||
|
IntPtr native_type = GLib.Marshaller.StringToPtrGStrdup (type);
|
||||||
|
IntPtr[] native_option_keys = NullTerm (option_keys);
|
||||||
|
IntPtr[] native_option_values = NullTerm (option_values);
|
||||||
|
bool saved = gdk_pixbuf_savev(Handle, native_filename, native_type, native_option_keys, native_option_values, out error);
|
||||||
|
GLib.Marshaller.Free (native_filename);
|
||||||
|
GLib.Marshaller.Free (native_type);
|
||||||
|
ReleaseArray (native_option_keys);
|
||||||
|
ReleaseArray (native_option_values);
|
||||||
|
|
||||||
|
if (!saved)
|
||||||
|
throw new GLib.GException (error);
|
||||||
|
return saved;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue