blender_vscode icon indicating copy to clipboard operation
blender_vscode copied to clipboard

Running bpy.ops.object.mode_set crashes Blender

Open RealTachyon opened this issue 6 months ago • 1 comments

Description

When running the bpy.ops.object.mode_set command in quick succession from the vscode extension, Blender crashes.

Log Stack

[INFO] (2025/06/07 12:44:08) mesh-fairing-master._internal._log():L97 - 127.0.0.1 - - [07/Jun/2025 12:44:08] "POST / HTTP/1.1" 200 -
0
1
2
3

 *  The terminal process "c:\Program Files\Blender Foundation\Blender 4.4\blender.exe '--python', 'c:\Users\<USER>\.vscode\extensions\jacqueslucke.blender-development-0.0.25\pythonFiles\launch.py', 'blender_files\experiments\vertex_groups\Vertex Groups Test V1.blend'" terminated with exit code: -1073741819. 

How to reproduce

  1. Write a new .py file with the following content.
  2. Run the Blender: Start command
  3. Add a new armature object with name Armature
  4. Run the Blender: Run Script command while having the new .py file active
  5. Notice that Blender crashes almost immediately. In my cases it got up to index 3.
import bpy

bpy.data.objects["Armature"]

for i in range(1000):
	print(i)
	for mode in ("EDIT", "POSE"):
		bpy.ops.object.mode_set(mode=mode)

The reason I think this is related to the addon, is because you can copy the content in a regular Blender file text editor, and run it from there. The behavior of this regular Blender is stable. It does not crash.

RealTachyon avatar Jun 07 '25 10:06 RealTachyon