mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 19:30:10 +00:00
Don't pass NULL to functions expecing a real string
...and when you do pass them a real string, don't leak it.
This commit is contained in:
parent
a8f663ce5e
commit
4573659deb
@ -240,7 +240,7 @@ static void
|
|||||||
gail_menu_item_init_textutil (GailMenuItem *item,
|
gail_menu_item_init_textutil (GailMenuItem *item,
|
||||||
GtkWidget *label)
|
GtkWidget *label)
|
||||||
{
|
{
|
||||||
const gchar *label_text;
|
gchar *label_text;
|
||||||
|
|
||||||
if (item->textutil == NULL)
|
if (item->textutil == NULL)
|
||||||
{
|
{
|
||||||
@ -251,7 +251,8 @@ gail_menu_item_init_textutil (GailMenuItem *item,
|
|||||||
item);
|
item);
|
||||||
}
|
}
|
||||||
label_text = get_text_from_label_widget (label);
|
label_text = get_text_from_label_widget (label);
|
||||||
gail_text_util_text_setup (item->textutil, label_text);
|
gail_text_util_text_setup (item->textutil, label_text ? label_text : "");
|
||||||
|
g_free (label_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* atktext.h */
|
/* atktext.h */
|
||||||
@ -279,7 +280,7 @@ gail_menu_item_get_text (AtkText *text,
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GailMenuItem *item;
|
GailMenuItem *item;
|
||||||
const gchar *label_text;
|
gchar *label_text;
|
||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||||
if (widget == NULL)
|
if (widget == NULL)
|
||||||
@ -297,8 +298,12 @@ gail_menu_item_get_text (AtkText *text,
|
|||||||
if (label_text == NULL)
|
if (label_text == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return gail_text_util_get_substring (item->textutil,
|
{
|
||||||
start_pos, end_pos);
|
g_free (label_text);
|
||||||
|
|
||||||
|
return gail_text_util_get_substring (item->textutil,
|
||||||
|
start_pos, end_pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
|
Loading…
Reference in New Issue
Block a user