Fixed segfault when creating a feature using a destroyed layer.