mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 02:06:18 +01:00
Merge branch 'th/g-ptr-array-extend-and-steal-crash' into 'master'
array: fix corrupt state of GPtrArray after g_ptr_array_extend_and_steal() See merge request GNOME/glib!1481
This commit is contained in:
commit
19b6e30cc7
@ -1890,6 +1890,7 @@ g_ptr_array_extend_and_steal (GPtrArray *array_to_extend,
|
|||||||
* to the elements moved from @array to @array_to_extend. */
|
* to the elements moved from @array to @array_to_extend. */
|
||||||
pdata = g_steal_pointer (&array->pdata);
|
pdata = g_steal_pointer (&array->pdata);
|
||||||
array->len = 0;
|
array->len = 0;
|
||||||
|
((GRealPtrArray *) array)->alloc = 0;
|
||||||
g_ptr_array_unref (array);
|
g_ptr_array_unref (array);
|
||||||
g_free (pdata);
|
g_free (pdata);
|
||||||
}
|
}
|
||||||
|
@ -1298,6 +1298,8 @@ pointer_array_extend_and_steal (void)
|
|||||||
g_assert_cmpuint (ptr_array3->len, ==, 0);
|
g_assert_cmpuint (ptr_array3->len, ==, 0);
|
||||||
g_assert_null (ptr_array3->pdata);
|
g_assert_null (ptr_array3->pdata);
|
||||||
|
|
||||||
|
g_ptr_array_add (ptr_array2, NULL);
|
||||||
|
|
||||||
g_ptr_array_free (ptr_array, TRUE);
|
g_ptr_array_free (ptr_array, TRUE);
|
||||||
g_ptr_array_free (ptr_array3, TRUE);
|
g_ptr_array_free (ptr_array3, TRUE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user