[gtkmm/gtkmm-3-22] Gtk::Editable, RecentChooser, Scale: Fix memory leaks
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-3-22] Gtk::Editable, RecentChooser, Scale: Fix memory leaks
- Date: Tue, 27 Jun 2017 15:21:10 +0000 (UTC)
commit b3528f28cae2e20b6d00a293563d577c0b20b911
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Tue Jun 27 17:18:58 2017 +0200
Gtk::Editable, RecentChooser, Scale: Fix memory leaks
Editable::get_chars_vfunc(), RecentChooser::get_current_uri_vfunc() and
Scale::signal_format_value() 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 ++--
gtk/src/scale.hg | 4 +---
3 files changed, 4 insertions(+), 5 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 c6fdb4e..d9a328e 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)
diff --git a/gtk/src/scale.hg b/gtk/src/scale.hg
index e76f883..d5e0fb8 100644
--- a/gtk/src/scale.hg
+++ b/gtk/src/scale.hg
@@ -101,11 +101,9 @@ public:
#m4 dnl// because that could be caused by an intermediate empty ustring from an initial null char*,
#m4 dnl//See bug http://bugzilla.gnome.org/show_bug.cgi?id=168747.
#m4 _CONVERSION(`Glib::ustring',`gchar*',`(strlen($3.c_str()) ? g_strdup($3.c_str()) : nullptr)')
+#m4 _CONVERSION(`gchar*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
_WRAP_SIGNAL(Glib::ustring format_value(double value), "format_value")
- // TODO: When we can break ABI, this signal needs to be
- // Glib::ustring format_value(double value, bool& use_default_formatting),
- // where use_default_formatting specifies whether the return value will actually be a null char*.
/** Number of displayed decimal digits.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]