Random crashes when using a BoxFactory and qt.View()

Hello,I get random crashes while using a Box Factory - Sometimes I get a Segfault, and sometimes I get the following error:

python3: /usr/include/boost/smart_ptr/shared_ptr.hpp:728: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = yade::Body; typename boost::detail::sp_member_access<T>::type = yade::Body*]: Assertion `px != 0' failed.
Aborted (core dumped)

You can run the following MWE a few times to see if you can replicate; for me in some cases the issue happens in under 30 sec of wall time. Any advice will go a long way! Thanks, Vasileios

# MWE for BoxFactory
# 2025 © Vasileios Angelidakis <v.angelidakis@qub.ac.uk>

from yade import qt, plot

# ----------------------------------------------------------------------------------------------------------------
# Particle properties
rMean			= 0.01	# mean particle radius
rRelFuzz		= 0.2	# relative dispersion of particle size, e.g. 0.2 corresponds to +-20% from the average radius

# ----------------------------------------------------------------------------------------------------------------
# Materials
O.materials.append(FrictMat(young=5e5, poisson=.25, frictionAngle=atan(0.9), density=2500, label='walls'))
O.materials.append(FrictMat(young=5e5, poisson=.25, frictionAngle=atan(0.9), density=2500, label='spheres'))

# ----------------------------------------------------------------------------------------------------------------
# Generate facetbox container
dx = 200 * rMean	# Length of the domain
dy = 10 * rMean		# Width of the domain
dz = 30 * rMean		# Height of the domain

O.bodies.append(geom.facetBox(center=(dx/2, dy/2, dz/2), extents=(dx, dy, dz), wallMask=31, wire=True, material='walls', color=[0,1,0]))

# ----------------------------------------------------------------------------------------------------------------
# Generate first particle to allow for easy initialisation, timestep calculation etc
O.bodies.append(sphere(center=(dx/2,dy/2,5*rMean), radius=rMean, material='spheres'))

# ----------------------------------------------------------------------------------------------------------------
# Timestep
O.dt = 0.8 * PWaveTimeStep() 

# ----------------------------------------------------------------------------------------------------------------
# Engines
O.engines = [
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), Bo1_Wall_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(hertzian=True), Ig2_Wall_Sphere_ScGeom(hertzian=True)],  # collision "geometry"
		[Ip2_FrictMat_FrictMat_MindlinPhys(en=0.6)],  # collision "physics"
		[Law2_ScGeom_MindlinPhys_Mindlin()]  # contact law -- apply forces
	),
	BoxFactory( # See the meaning of the paramers below at https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.BoxFactory
		maxParticles=20000,
		extents=(10*rMean, 0.4*dy, 5*rMean),
		center=(dx/2, dy/2, dz+20*rMean),
		rMin=(rMean-rRelFuzz*rMean),
		rMax=(rMean+rRelFuzz*rMean),
		vMin=0,
		vMax=0,
		vAngle=0,
		massFlowRate=5,
		normal=(0, 0, -1),
		silent=False,
		stopIfFailed=False,
		mask=1,
		label='factory',
		materialId=O.materials['spheres'].id
	),
	NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.0), # No numerical damping of energy in the integrator!!
]

# ----------------------------------------------------------------------------------------------------------------
# Save the simulation, so that it can be reloaded later, for experimentation
O.saveTmp()

# Visualisation
v=qt.View()
rndr=qt.Renderer()

v.eyePosition = Vector3(dx/2,-2.5*dx,2*dz)
v.upVector = Vector3(0,0,1)
v.viewDir = Vector3(0,1,0)

v.sceneRadius = dx*1.5

For your information, some system/installation info:

In [1]: printAllVersions()

Yade version   :  20251112-8892~5ff17a7~jammy1
Yade features  :  LOGGER USEFUL_ERRORS COMPLEX_MP VTK OPENMP GTS QT5 CGAL PFVFLOW PFVFLOW LINSOLV MPI TWOPHASEFLOW LS_DEM FEMLIKE GL2PS LBMFLOW THERMAL PARTIALSAT POTENTIAL_PARTICLES POTENTIAL_BLOCKS
Yade config dir:  ~/.config/yadedaily
Yade precision :  53 bits, 15 decimal places, with mpmath, PrecisionDouble
Yade RealHP<…> :  (15, 33, 45, 60, 120, 150, 300) decimal digits in C++, (15, 33) decimal digits accessible from python

Libraries used :

| library       | cmake                 | C++                 |
| ------------- | --------------------- | ------------------- |
| Xlib          | (0,29)                |                     |
| boost         | 107400                | 1.74.0              |
| cgal          |                       | 5.4                 |
| clp           | 1.17.5                | 1.17.5              |
| cmake         | 3.22.1                |                     |
| coinutils     | 2.11.4                | 2.11.4              |
| compiler      | /usr/bin/c++ 11.4.0   | gcc 11.4.0          |
| eigen         | 3.4.0                 | 3.4.0               |
| freeglut      | 2.8.1                 |                     |
| gl            |                       | 20190805            |
| ipython       | 7.31.1                |                     |
| matplotlib    | 3.5.1                 |                     |
| metis         |                       | 5.1.0               |
| mpi           | 3.1                   | ompi:4.1.2          |
| mpi4py        | 3.1.3                 |                     |
| mpmath        | 1.2.1                 |                     |
| numpy         | 1.21.5                |                     |
| openblas      |                       |  OpenBLAS 0.3.20    |
| pygraphviz    | 1.7                   |                     |
| python        | 3.10.12               | 3.10.12             |
| qglviewer     |                       | 2.6.3               |
| qt            |                       | 5.15.3              |
| sphinx        | 4.3.2                 |                     |
| sqlite        |                       | 3.37.2              |
| suitesparse   | 5.10.1                | 5.10.1              |
| tkinter       | 8.6                   |                     |
| vtk           | 9.1.0                 | 9.1.0               |


Linux version  :  Ubuntu 22.04.5 LTS
Architecture   :  amd64
Little endian  :  True