Page MenuHome

Blender Crashes during python modal operator
Closed, ArchivedPublic

Description

System Information
Operating system: Windows

Short description of error
I did an addon which creates objects in modal mode during mesh editing. And I found that blender crashes during parameters changing. I recorded video.
I attached my addon and a test file.

If I comment a line 395 (vs_coll.objects.link(new_obj)) then there will be no crash. The crash happens during objects linking.



Exact steps for others to reproduce the error

  • install my addon
  • Press Run button as in video
  • rightclick->subdivide
  • change subdivide parameters several times as in video.

Crash.

Event Timeline

paul geraskin (mifth) updated the task description. (Show Details)
Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Apr 6 2021, 10:40 AM

Can confirm.
These might be related:

T84647: Crash: Python/Undo related crash in BKE_scene_object_base_flag_sync_from_base (adding manual undo push does not help)
T85436: Separate by loose parts weird result. (same backtrace)

1   BKE_scene_object_base_flag_sync_from_base scene.c              2923  0x35b6ee4 
2   BKE_scene_set_background                  scene.c              2126  0x35b5654 
3   setup_app_data                            blendfile.c          379   0x4c062f6 
4   setup_app_blend_file_data                 blendfile.c          417   0x4c063fd 
5   BKE_blendfile_read_setup_ex               blendfile.c          455   0x4c064ee 
6   BKE_blendfile_read_setup                  blendfile.c          464   0x4c06539 
7   BKE_memfile_undo_decode                   blender_undo.c       96    0x4c05692 
8   memfile_undosys_step_decode               memfile_undo.c       193   0x48f6b82 
9   undosys_step_decode                       undo_system.c        215   0x4c66119 
10  BKE_undosys_step_load_data_ex             undo_system.c        813   0x4c67c2a 
11  ed_undo_step_by_name                      ed_undo.c            350   0x48f4c7f 
12  ED_undo_pop_op                            ed_undo.c            429   0x48f4fc8 
13  ED_undo_operator_repeat                   ed_undo.c            704   0x48f5913 
14  ED_undo_operator_repeat_cb_evt            ed_undo.c            750   0x48f5ac8 
15  ui_apply_but_funcs_after                  interface_handlers.c 964   0x4917e5e 
16  ui_handler_region_menu                    interface_handlers.c 10863 0x4932b7f 
17  wm_handler_ui_call                        wm_event_system.c    693   0x3a2a1ca 
18  wm_handlers_do_intern                     wm_event_system.c    2815  0x3a2f79f 
19  wm_handlers_do                            wm_event_system.c    2931  0x3a2fc56 
20  wm_event_do_handlers                      wm_event_system.c    3348  0x3a30e70

Will tag Core module since this is Undo-related.

Bastien Montagne (mont29) closed this task as Archived.Oct 7 2021, 3:32 PM

the code of this addon is broken (if you do not return 'FINISHED' while changing the data, you skip generating the undo step while having modified data, which is invalid and will break undo system).

Please do not use this tracker for python development support.

Hi @Bastien Montagne (mont29) , let me express some statements, please:

1 I've created a procedural mdeling tool and I'm using this code here https://blendermarket.com/products/bspheres
2 I donate to the Blender Foundation from every sale
3 I have to use a modal operator to achieve realtime performance.
4 Blender crashes. Not my addon. I assume this is a bug of Blender.
5 I reported a bug as I had a crash from Blender's side. I assume I reported correctly.

Thanks.

Blender crashes after using you addon, because said addon does not behave properly (as explained in previous comment). Support for proper python coding is not part of this tracker's targets.

An addon is a program, not a user interacting with the software, therefore it has more power, which comes with more responsibilities when it comes to not breaking the rest of the software. There are millions of ways to make Blender crash from python code, just as from changing its C code.