Skip to content

Commit 856e2c5

Browse files
committed
display module: Fix some memory leaks.
1 parent 3ab95fe commit 856e2c5

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

panels/display/cc-display-arrangement.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ cc_display_arrangement_draw (GtkWidget *widget,
706706
gtk_style_context_get (context, state, "font", &font, NULL);
707707
layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), number_str);
708708
pango_layout_set_font_description (layout, font);
709+
pango_font_description_free (font);
709710
pango_layout_get_extents (layout, NULL, &extents);
710711

711712
h = (extents.height - extents.y) / PANGO_SCALE;

panels/display/cc-display-panel.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,9 @@ cc_display_panel_dispose (GObject *object)
480480
g_clear_object (&self->labeler);
481481
g_clear_pointer (&self->palette, g_free);
482482

483+
g_clear_object (&self->output_selection_list);
484+
g_clear_object (&self->builder);
485+
483486
g_signal_handlers_disconnect_by_func (self, widget_visible_changed, NULL);
484487

485488
G_OBJECT_CLASS (cc_display_panel_parent_class)->dispose (object);
@@ -722,9 +725,10 @@ rebuild_ui (CcDisplayPanel *panel)
722725

723726
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 20, 20);
724727

725-
gchar *color_string = get_color_string_for_output (output);
728+
gchar *color_string = get_color_string_for_output (panel, index);
726729

727730
gdk_rgba_parse (&color, color_string);
731+
g_free (color_string);
728732

729733
pixel = pixel + ((int) (color.red * 255) << 24);
730734
pixel = pixel + ((int) (color.green * 255) << 16);
@@ -751,6 +755,8 @@ rebuild_ui (CcDisplayPanel *panel)
751755
2, pixbuf,
752756
-1);
753757

758+
g_object_unref (pixbuf);
759+
754760
if (!cc_display_monitor_is_usable (output))
755761
continue;
756762

panels/display/cc-display-settings.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
414414
1, l->data,
415415
-1);
416416

417+
g_free (resolution_string);
418+
417419
if (current_mode == l->data)
418420
{
419421
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self->resolution_combo), &iter);
@@ -678,6 +680,7 @@ cc_display_settings_finalize (GObject *object)
678680
g_clear_object (&self->orientation_list);
679681
g_clear_object (&self->refresh_rate_list);
680682
g_clear_object (&self->resolution_list);
683+
g_clear_object (&self->builder);
681684

682685
if (self->idle_udpate_id)
683686
g_source_remove (self->idle_udpate_id);

shell/cc-shell-item-view.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ cc_shell_item_view_update_cells (CcShellItemView *view)
166166
break;
167167
}
168168
}
169+
170+
g_list_free (cells);
169171
}
170172

171173
static void

0 commit comments

Comments
 (0)