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
1 changed files with 81 additions and 88 deletions
|
@ -180,21 +180,15 @@ namespace Gtk {
|
||||||
|
|
||||||
static IntPtr FileChooserNativeCreate (string title, Gtk.Window parent, Gtk.FileChooserAction action, string accept_label, string cancel_label)
|
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_title = GLib.Marshaller.StringToPtrGStrdup(title);
|
||||||
IntPtr native_accept_label = IntPtr.Zero;
|
IntPtr native_accept_label = GLib.Marshaller.StringToPtrGStrdup(accept_label);
|
||||||
if (accept_label != null)
|
IntPtr native_cancel_label = GLib.Marshaller.StringToPtrGStrdup(cancel_label);
|
||||||
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 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);
|
GLib.Marshaller.Free(native_title);
|
||||||
if (accept_label != null)
|
GLib.Marshaller.Free(native_accept_label);
|
||||||
GLib.Marshaller.Free (native_accept_label);
|
GLib.Marshaller.Free(native_cancel_label);
|
||||||
if (cancel_label != null)
|
|
||||||
GLib.Marshaller.Free (native_cancel_label);*/
|
|
||||||
|
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
@ -320,4 +314,3 @@ namespace Gtk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue