[gtk+] menuitem: Fix small memory leak in get_label
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] menuitem: Fix small memory leak in get_label
- Date: Fri, 1 Sep 2017 17:03:16 +0000 (UTC)
commit 2cd9f43d2fdff7ae01e0a3cd72975c7813b64da9
Author: Timm Bäder <mail baedert org>
Date: Thu Aug 31 13:14:33 2017 +0200
menuitem: Fix small memory leak in get_label
g_object_get returs a newly allocated string so we can't use it here.
gtk/gtkmenuitem.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 5680bc8..9deb8b4 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1306,15 +1306,10 @@ gtk_real_menu_item_get_label (GtkMenuItem *menu_item)
gtk_menu_item_ensure_label (menu_item);
child = gtk_bin_get_child (GTK_BIN (menu_item));
- if (GTK_IS_LABEL (child) ||
- GTK_IS_ACCEL_LABEL (child))
- {
- const char *label;
-
- g_object_get (child, "label", &label, NULL);
-
- return label;
- }
+ if (GTK_IS_LABEL (child))
+ return gtk_label_get_label (GTK_LABEL (child));
+ else if (GTK_IS_ACCEL_LABEL (child))
+ return gtk_accel_label_get_label (GTK_ACCEL_LABEL (child));
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]