I’ve got a really weird problem, and really don’t know how to tackle it anymore. I have created an operator that copies the active material to decals from DecalMachine. It was quite hard to even replicate the crash at first, since it only crashed very rarely, but I found a way to replicate the crash by saving a scene with a certain material and certain decals and then running the operator.
Now here is the weird part: I repeat the exact same actions every time: I open the blend file and immediately run the operator, nothing else is touched or changed. And then, sometimes it crashes and sometimes it doesn’t… I was trying to find a pattern before about when it crashed, but it seems to be totally random since in my latest tests everything is the exact same, even the selection order is saved in the blend file… Sometimes it doesn’t crash for 8 straight tries and then the 9th time it crashes anyways.
My main question is: How can a python script crash so randomly while all parameters are exactly the same every time?
My first hunch was that the script was accessing data-blocks that were deleted, but after removing all lines that delete data-blocks it still crashes. And it wouldn’t make any sense that it crashes randomly then anyways
The code for the operator can be found here: https://github.com/OliverJPost/Decal_Matching_InstaMat/blob/main/SMR_DECALMACHINE.py
The crash log for one of the crashes can be found here:
Sometimes it backtraces to line 223, other times to 345. I’ve tried putting these lines in try/excepts even though it didn’t make any sense to me that these lines would be the cause anyways.
Let me know if you have any advice for where I could start trying to fix this