mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-22 20:05:41 +00:00
FileChooserNative: allow null parent, free memory (#322)
* FileChooserNative: allow null parent, free memory Also make consistent whitespaces, new lines. * Re-run checks
This commit is contained in:
parent
0915bf8076
commit
c362ad1468
|
@ -181,20 +181,14 @@ namespace Gtk {
|
|||
static IntPtr FileChooserNativeCreate (string title, Gtk.Window parent, Gtk.FileChooserAction action, string accept_label, string cancel_label)
|
||||
{
|
||||
IntPtr native_title = GLib.Marshaller.StringToPtrGStrdup(title);
|
||||
IntPtr native_accept_label = IntPtr.Zero;
|
||||
if (accept_label != null)
|
||||
native_accept_label = GLib.Marshaller.StringToPtrGStrdup (accept_label);
|
||||
IntPtr native_cancel_label = IntPtr.Zero;
|
||||
if (cancel_label != null)
|
||||
native_cancel_label = GLib.Marshaller.StringToPtrGStrdup (cancel_label);
|
||||
IntPtr native_accept_label = GLib.Marshaller.StringToPtrGStrdup(accept_label);
|
||||
IntPtr native_cancel_label = GLib.Marshaller.StringToPtrGStrdup(cancel_label);
|
||||
|
||||
IntPtr raw = gtk_file_chooser_native_new(native_title, parent.Handle, (int) action, native_accept_label, native_cancel_label);
|
||||
IntPtr raw = gtk_file_chooser_native_new(native_title, parent != null ? parent.Handle : IntPtr.Zero, (int) action, native_accept_label, native_cancel_label);
|
||||
|
||||
/*GLib.Marshaller.Free (native_title);
|
||||
if (accept_label != null)
|
||||
GLib.Marshaller.Free(native_title);
|
||||
GLib.Marshaller.Free(native_accept_label);
|
||||
if (cancel_label != null)
|
||||
GLib.Marshaller.Free (native_cancel_label);*/
|
||||
GLib.Marshaller.Free(native_cancel_label);
|
||||
|
||||
return raw;
|
||||
}
|
||||
|
@ -320,4 +314,3 @@ namespace Gtk {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue