Skip to content

Commit

Permalink
display module: Fix some memory leaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed Nov 15, 2023
1 parent 3ab95fe commit 856e2c5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions panels/display/cc-display-arrangement.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ cc_display_arrangement_draw (GtkWidget *widget,
gtk_style_context_get (context, state, "font", &font, NULL);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), number_str);
pango_layout_set_font_description (layout, font);
pango_font_description_free (font);
pango_layout_get_extents (layout, NULL, &extents);

h = (extents.height - extents.y) / PANGO_SCALE;
Expand Down
8 changes: 7 additions & 1 deletion panels/display/cc-display-panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ cc_display_panel_dispose (GObject *object)
g_clear_object (&self->labeler);
g_clear_pointer (&self->palette, g_free);

g_clear_object (&self->output_selection_list);
g_clear_object (&self->builder);

g_signal_handlers_disconnect_by_func (self, widget_visible_changed, NULL);

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

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

gchar *color_string = get_color_string_for_output (output);
gchar *color_string = get_color_string_for_output (panel, index);

gdk_rgba_parse (&color, color_string);
g_free (color_string);

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

g_object_unref (pixbuf);

if (!cc_display_monitor_is_usable (output))
continue;

Expand Down
3 changes: 3 additions & 0 deletions panels/display/cc-display-settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
1, l->data,
-1);

g_free (resolution_string);

if (current_mode == l->data)
{
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self->resolution_combo), &iter);
Expand Down Expand Up @@ -678,6 +680,7 @@ cc_display_settings_finalize (GObject *object)
g_clear_object (&self->orientation_list);
g_clear_object (&self->refresh_rate_list);
g_clear_object (&self->resolution_list);
g_clear_object (&self->builder);

if (self->idle_udpate_id)
g_source_remove (self->idle_udpate_id);
Expand Down
2 changes: 2 additions & 0 deletions shell/cc-shell-item-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ cc_shell_item_view_update_cells (CcShellItemView *view)
break;
}
}

g_list_free (cells);
}

static void
Expand Down

0 comments on commit 856e2c5

Please sign in to comment.