The way GLib g_ptr_array_insert works and the way it is intended to work here is not the same.

GLib adds the new element, but if index=0 then index=16, array will be 17 in length, and accessing index 1 will segfault