Commit 33966984 authored by Christian Hergert's avatar Christian Hergert

bolding: release allocated list when filtering

The filter function returns a newly allocated list that we are responsible
to free.
parent 1691307d
...@@ -158,6 +158,7 @@ void ...@@ -158,6 +158,7 @@ void
dzl_bolding_label_set_weight (DzlBoldingLabel *self, dzl_bolding_label_set_weight (DzlBoldingLabel *self,
PangoWeight weight) PangoWeight weight)
{ {
PangoAttrList *filtered;
PangoAttrList *attrs; PangoAttrList *attrs;
PangoAttrList *copy; PangoAttrList *copy;
PangoAttribute *attr; PangoAttribute *attr;
...@@ -170,10 +171,11 @@ dzl_bolding_label_set_weight (DzlBoldingLabel *self, ...@@ -170,10 +171,11 @@ dzl_bolding_label_set_weight (DzlBoldingLabel *self,
else else
copy = pango_attr_list_new (); copy = pango_attr_list_new ();
attr = pango_attr_weight_new (weight); attr = pango_attr_weight_new (weight);
pango_attr_list_filter (copy, remove_weights, attr); filtered = pango_attr_list_filter (copy, remove_weights, attr);
pango_attr_list_insert (copy, attr); pango_attr_list_insert (copy, attr);
gtk_label_set_attributes (GTK_LABEL (self), copy); gtk_label_set_attributes (GTK_LABEL (self), copy);
gtk_widget_queue_draw (GTK_WIDGET (self)); gtk_widget_queue_draw (GTK_WIDGET (self));
pango_attr_list_unref (filtered);
pango_attr_list_unref (copy); pango_attr_list_unref (copy);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment