[gtkmm] Gtk::Editable and RecentChooser: Plug memory leaks in vfuncs



commit aa4768211fba187d113cf5ef3941638da36ac91a
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Jun 26 16:15:19 2017 +0200

    Gtk::Editable and RecentChooser: Plug memory leaks in vfuncs
    
    Editable::get_chars_vfunc() and RecentChooser::get_current_uri_vfunc()
    shall delete the returned character array after it has been copied to a
    Glib::ustring. Bug 783360

 gtk/src/editable.hg      |    1 +
 gtk/src/recentchooser.hg |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/src/editable.hg b/gtk/src/editable.hg
index 5569ead..e003166 100644
--- a/gtk/src/editable.hg
+++ b/gtk/src/editable.hg
@@ -125,6 +125,7 @@ dnl // C prototype: void do_insert_text(const gchar* text, gint length, gint* po
 dnl // This special conversion is not in convert_gtk.m4, because allocating a new
 dnl // string is rarely needed -- probably not a good idea to make this generic.
   _CONVERSION(`Glib::ustring', `gchar*', `g_strdup(($3).c_str())')
+  _CONVERSION(`gchar*', `Glib::ustring', `Glib::convert_return_gchar_ptr_to_ustring($3)')
 #m4end
   _WRAP_VFUNC(Glib::ustring get_chars(int start_pos, int end_pos) const, get_chars)
 
diff --git a/gtk/src/recentchooser.hg b/gtk/src/recentchooser.hg
index 9171b74..2aff0d3 100644
--- a/gtk/src/recentchooser.hg
+++ b/gtk/src/recentchooser.hg
@@ -139,8 +139,6 @@ public:
   _WRAP_PROPERTY("filter", Glib::RefPtr<RecentFilter>)
 
 protected:
-#m4 _CONVERSION(`Glib::ustring', `gchar*', `g_strdup(($3).c_str())')
-
   // TODO: How to wrap those vfuncs?
   // TODO: Also: use vectorutils.
 
@@ -148,6 +146,8 @@ protected:
   //_CONVERSION(`Glib::SListHandle<RecentFilter*>', `GSList*', `($3).data()')
 
   //_WRAP_VFUNC(bool set_current_uri(const Glib::ustring& uri), "set_current_uri", errthrow)
+#m4 _CONVERSION(`Glib::ustring', `gchar*', `g_strdup(($3).c_str())')
+#m4 _CONVERSION(`gchar*', `Glib::ustring', `Glib::convert_return_gchar_ptr_to_ustring($3)')
   _WRAP_VFUNC(Glib::ustring get_current_uri() const, "get_current_uri")
 
 #m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]