malcontent-control: Fix some minor leaks in MctCarousel

Relevant chunks upstreamed in
https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/683.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-01-10 17:11:39 +00:00
parent 2c043a6bd5
commit 9e73c34664
1 changed files with 19 additions and 1 deletions

View File

@ -324,7 +324,7 @@ mct_carousel_add (GtkContainer *container,
last_box_is_full = ((g_list_length (self->children) - 1) % ITEMS_PER_PAGE == 0);
if (last_box_is_full)
{
gchar *page;
g_autofree gchar *page = NULL;
page = g_strdup_printf ("%d", MCT_CAROUSEL_ITEM (widget)->page);
self->last_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@ -365,9 +365,25 @@ mct_carousel_new (void)
return g_object_new (MCT_TYPE_CAROUSEL, NULL);
}
static void
mct_carousel_dispose (GObject *object)
{
MctCarousel *self = MCT_CAROUSEL (object);
g_clear_object (&self->provider);
if (self->children != NULL)
{
g_list_free (self->children);
self->children = NULL;
}
G_OBJECT_CLASS (mct_carousel_parent_class)->dispose (object);
}
static void
mct_carousel_class_init (MctCarouselClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
@ -382,6 +398,8 @@ mct_carousel_class_init (MctCarouselClass *klass)
gtk_widget_class_bind_template_callback (wclass, mct_carousel_goto_previous_page);
gtk_widget_class_bind_template_callback (wclass, mct_carousel_goto_next_page);
object_class->dispose = mct_carousel_dispose;
container_class->add = mct_carousel_add;
signals[ITEM_ACTIVATED] =