widget: Fix transform refcounting in allocate()

Make the transform (transfer full).

1. This makes sure we actually reference the transform. Previously we
   did not.
2. Most callers create a new transform to pass to us. Now they don't
   have to uref it anymore.
This commit is contained in:
Benjamin Otte 2019-05-29 14:48:27 +02:00
parent 89fb752a8f
commit a079fd2def
4 changed files with 4 additions and 11 deletions

View File

@ -301,7 +301,7 @@ gtk_fixed_layout_allocate (GtkLayoutManager *layout_manager,
child_req.width,
child_req.height,
-1,
child_info->position);
gsk_transform_ref (child_info->position));
}
}

View File

@ -458,7 +458,6 @@ gtk_revealer_real_size_allocate (GtkWidget *widget,
}
gtk_widget_allocate (child, child_width, child_height, -1, transform);
gsk_transform_unref (transform);
}
static void

View File

@ -4233,8 +4233,6 @@ gtk_widget_size_allocate (GtkWidget *widget,
allocation->height,
baseline,
transform);
gsk_transform_unref (transform);
}
/**
@ -4243,7 +4241,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
* @width: New width of @widget
* @height: New height of @widget
* @baseline: New baseline of @widget, or -1
* @transform: (transfer none) (allow-none): Transformation to be applied to @widget
* @transform: (transfer full) (allow-none): Transformation to be applied to @widget
*
* This function is only used by #GtkWidget subclasses, to assign a size,
* position and (optionally) baseline to their child widgets.
@ -4303,10 +4301,8 @@ gtk_widget_allocate (GtkWidget *widget,
priv->allocated_height != height);
transform_changed = !gsk_transform_equal (priv->allocated_transform, transform);
/* order is important, sometimes priv->allocated_transform == transform */
gsk_transform_ref (transform);
gsk_transform_unref (priv->allocated_transform);
priv->allocated_transform = transform;
priv->allocated_transform = gsk_transform_ref (transform);
priv->allocated_width = width;
priv->allocated_height = height;
priv->allocated_size_baseline = baseline;
@ -11435,7 +11431,7 @@ gtk_widget_ensure_allocate (GtkWidget *widget)
priv->allocated_width,
priv->allocated_height,
priv->allocated_size_baseline,
priv->allocated_transform);
gsk_transform_ref (priv->allocated_transform));
}
else if (priv->alloc_needed_on_child)
{

View File

@ -128,8 +128,6 @@ gtk_transform_tester_size_allocate (GtkWidget *widget,
w, h,
-1,
global_transform);
gsk_transform_unref (global_transform);
}
static void