mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
transform: Don't crash for gsk_transform_transform (id, id)
See attached tests
This commit is contained in:
parent
b50093d044
commit
7597f6b594
@ -1624,8 +1624,10 @@ gsk_transform_transform (GskTransform *next,
|
||||
|
||||
if (gsk_transform_is_identity (next))
|
||||
{
|
||||
/* ref before unref to avoid catastrophe when other == next */
|
||||
other = gsk_transform_ref (other);
|
||||
gsk_transform_unref (next);
|
||||
return gsk_transform_ref (other);
|
||||
return other;
|
||||
}
|
||||
|
||||
next = gsk_transform_transform (next, other->next);
|
||||
|
@ -336,12 +336,30 @@ static void
|
||||
test_identity_equal (void)
|
||||
{
|
||||
GskTransform *id = gsk_transform_new ();
|
||||
GskTransform *t;
|
||||
|
||||
g_assert_true (gsk_transform_equal (NULL, NULL));
|
||||
g_assert_true (gsk_transform_equal (id, NULL));
|
||||
g_assert_true (gsk_transform_equal (NULL, id));
|
||||
g_assert_true (gsk_transform_equal (id, id));
|
||||
|
||||
t = gsk_transform_transform (NULL, NULL);
|
||||
g_assert_true (gsk_transform_equal (t, NULL));
|
||||
gsk_transform_unref (t);
|
||||
t = gsk_transform_transform (gsk_transform_new (), NULL);
|
||||
g_assert_true (gsk_transform_equal (t, NULL));
|
||||
gsk_transform_unref (t);
|
||||
t = gsk_transform_transform (NULL, id);
|
||||
g_assert_true (gsk_transform_equal (t, NULL));
|
||||
gsk_transform_unref (t);
|
||||
t = gsk_transform_transform (gsk_transform_new (), id);
|
||||
g_assert_true (gsk_transform_equal (t, NULL));
|
||||
gsk_transform_unref (t);
|
||||
t = gsk_transform_new ();
|
||||
t = gsk_transform_transform (t, t);
|
||||
g_assert_true (gsk_transform_equal (t, NULL));
|
||||
gsk_transform_unref (t);
|
||||
|
||||
gsk_transform_unref (id);
|
||||
}
|
||||
|
||||
@ -394,6 +412,7 @@ main (int argc,
|
||||
g_test_add_func ("/transform/conversions/simple", test_conversions_simple);
|
||||
g_test_add_func ("/transform/conversions/transformed", test_conversions_transformed);
|
||||
g_test_add_func ("/transform/identity", test_identity);
|
||||
g_test_add_func ("/transform/identity-equal", test_identity_equal);
|
||||
g_test_add_func ("/transform/invert", test_invert);
|
||||
g_test_add_func ("/transform/print-parse", test_print_parse);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user