When textures are deleted they are not cleaned up from custom materials. If a custom material doesn't have parent node assigned (another questing why it may happen), when invalid texture pointers are dereferenced the application crashes.
To reproduce:
Run the attached example and set a break point to:
QQuick3DCustomMaterial::setDynamicTextureMap
Textures are dynamically created via Timer, set to a custom material and deleted.
Whenever a texture is created it is added to m_dynamicTextureMaps, but the texture is never cleaned up from the array when it is deleted.
Crash happens if condition (mat.material->parentItem() == nullptr) is met in:
QQuick3DModel::qmlClearMaterials
It tries to access the textures in QQuick3DCustomMaterial::itemChange, but the references in m_dynamicTextureMaps are not valid.