diff --git a/ChangeLog b/ChangeLog index 48c4c4394..2d9474c0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-11-04 Todd Berman + + * doc/en/GLib/ListBase.xml: Add documentation for ListBase.Empty + * glib/ListBase.cs: Add ListBase.Empty, frees the children and the + list. + * glib/Markup.cs: Fix Alex's tomboy crash, sending -1 instead of + Length. + * gtk/FileChooserDialog.custom: + * gtk/FileChooserWidget.custom: properly free the list. + 2004-11-03 Todd Berman * gtk/FileChooserDialog.custom: diff --git a/doc/en/GLib/ListBase.xml b/doc/en/GLib/ListBase.xml index 8b8d7cef0..bc64c56bd 100644 --- a/doc/en/GLib/ListBase.xml +++ b/doc/en/GLib/ListBase.xml @@ -259,5 +259,17 @@ + + + Method + + System.Void + + + + Empties the list. + Empties, and frees the list, as well as all of its children + + - \ No newline at end of file + diff --git a/glib/ListBase.cs b/glib/ListBase.cs index 620850e09..a151201af 100644 --- a/glib/ListBase.cs +++ b/glib/ListBase.cs @@ -153,6 +153,23 @@ namespace GLib { return ret; } + [DllImport ("libglib-2.0-0.dll")] + static extern void g_free (IntPtr item); + + [DllImport ("libglib-2.0-0.dll")] + static extern void g_object_unref (IntPtr item); + + public void Empty () + { + for (uint i = 0; i < Count; i++) + { + if (element_type == typeof (GLib.Object)) + g_object_unref (NthData (i)); + else + g_free (NthData (i)); + } + Dispose (); + } private class ListEnumerator : IEnumerator { diff --git a/glib/Markup.cs b/glib/Markup.cs index 660370787..5c25b492a 100644 --- a/glib/Markup.cs +++ b/glib/Markup.cs @@ -37,7 +37,7 @@ namespace GLib { if (s == null) return ""; - return Marshaller.PtrToStringGFree (g_markup_escape_text (s, s.Length)); + return Marshaller.PtrToStringGFree (g_markup_escape_text (s, -1)); } } } diff --git a/gtk/FileChooserDialog.custom b/gtk/FileChooserDialog.custom index a51804b96..c68fbea39 100644 --- a/gtk/FileChooserDialog.custom +++ b/gtk/FileChooserDialog.custom @@ -63,6 +63,7 @@ string[] result = new string [list.Count]; for (int i = 0; i < list.Count; i++) result [i] = (string) list [i]; + list.Empty (); return result; } } diff --git a/gtk/FileChooserWidget.custom b/gtk/FileChooserWidget.custom index df898ecba..9abc8d4d2 100644 --- a/gtk/FileChooserWidget.custom +++ b/gtk/FileChooserWidget.custom @@ -31,6 +31,7 @@ public string[] Filenames { string[] result = new string [list.Count]; for (int i = 0; i < list.Count; i++) result [i] = (string) list [i]; + list.Empty (); return result; } }