Collection Manager: Crash when toggling option in 'Adjust Last Operation' #75738

Closed
opened 2020-04-15 00:28:28 +02:00 by Jay Edwards · 14 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce 940MX/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75

Blender Version
Broken: version: 2.83 (sub 13), branch: master, commit date: 2020-04-14 17:24, hash: blender/blender@bf49bb354f
Worked: (newest version of Blender that worked as expected)

Short description of error
after pressing another button to toggle the visible collection in the number row. If you press the context menu for QCD blender will instantly crash.

Exact steps for others to reproduce the error

  • add multiple collections to your scene from outliner
  • press a number on the Numpad to toggle visibility of the collection
  • press the Toggle option in the View QCD Slot Adjust Last Operation HUD [bottom left panel or {key F9} or Edit > Adjust Last Operation]
    blender will crash immediately.
**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce 940MX/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75 **Blender Version** Broken: version: 2.83 (sub 13), branch: master, commit date: 2020-04-14 17:24, hash: `blender/blender@bf49bb354f` Worked: (newest version of Blender that worked as expected) **Short description of error** after pressing another button to toggle the visible collection in the number row. If you press the context menu for QCD blender will instantly crash. **Exact steps for others to reproduce the error** - add multiple collections to your scene from outliner - press a number on the Numpad to toggle visibility of the collection - press the `Toggle` option in the `View QCD Slot` Adjust Last Operation HUD [bottom left panel or {key F9} or `Edit` > `Adjust Last Operation`] blender will crash immediately.
Author

Added subscriber: @Jaye.Antoni_Whyldz

Added subscriber: @Jaye.Antoni_Whyldz
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Not sure I understand correctly (sorry about this):

  • What is the View QCD Slot popup context menu?
  • I can see the tooltips on mouseover, but no real context menu
  • I can use {key Shift LMB} to toggle the QCD slot without crash... is that what you meant?
Not sure I understand correctly (sorry about this): - What is the `View QCD Slot popup context menu`? - I can see the tooltips on mouseover, but no real context menu - I can use {key Shift LMB} to toggle the QCD slot without crash... is that what you meant?
Philipp Oeser changed title from Crash when toggling QCD context menu to Collection Manager: Crash when toggling QCD context menu 2020-04-15 11:08:44 +02:00
Author

When u switch something from one collection go another, you press the poup menue that comes up at the bottom left of the 3d veiwport and press the toggle option in it

When u switch something from one collection go another, you press the poup menue that comes up at the bottom left of the 3d veiwport and press the toggle option in it
Member

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Member

Ah, that... can confirm, checking...

Ah, that... can confirm, checking...
Philipp Oeser changed title from Collection Manager: Crash when toggling QCD context menu to Collection Manager: Crash when toggling option in 'Adjust Last Operation' 2020-04-15 15:06:31 +02:00
Member

Added subscriber: @Imaginer

Added subscriber: @Imaginer
Member

Havent checked in detail, here is a trace:

1   rna_iterator_listbase_next       rna_access.c      4847 0x33003d6      
2   LayerCollection_children_next    rna_layer_gen.c   2193 0x33744c6      
3   RNA_property_collection_next     rna_access.c      3956 0x32fd71f      
4   RNA_property_collection_length   rna_access.c      4015 0x32fd981      
5   pyrna_prop_collection_length     bpy_rna.c         2307 0x34eb337      
6   builtin_len                                             0x7ffff39e02fc 
7   _PyMethodDef_RawFastCallKeywords                        0x7ffff39d9b13 
8   _PyCFunction_FastCallKeywords                           0x7ffff39d9d43 
9   call_function                                           0x7ffff3a0c203 
10  _PyEval_EvalFrameDefault                                0x7ffff3a424ce 
11  _PyFunction_FastCallKeywords                            0x7ffff39fa2d2 
12  call_function                                           0x7ffff3a0c0ef 
13  _PyEval_EvalFrameDefault                                0x7ffff3a424ce 
14  _PyEval_EvalCodeWithName                                0x7ffff39f9430 
15  _PyFunction_FastCallDict                                0x7ffff39fab0e 
16  bpy_class_call                   bpy_rna.c         8505 0x34f64c1      
17  rna_operator_execute_cb          rna_wm.c          1325 0x34bbe65      
18  wm_operator_exec                 wm_event_system.c 986  0x2e902b0      
19  WM_operator_repeat               wm_event_system.c 1062 0x2e9057f      
20  ED_undo_operator_repeat          ed_undo.c         595  0x3973c4c    

@Imaginer: is this something you can look into? [if this is some fault in the py API this should be fixed as well, but maybe there is a workaround?]

Havent checked in detail, here is a trace: ``` 1 rna_iterator_listbase_next rna_access.c 4847 0x33003d6 2 LayerCollection_children_next rna_layer_gen.c 2193 0x33744c6 3 RNA_property_collection_next rna_access.c 3956 0x32fd71f 4 RNA_property_collection_length rna_access.c 4015 0x32fd981 5 pyrna_prop_collection_length bpy_rna.c 2307 0x34eb337 6 builtin_len 0x7ffff39e02fc 7 _PyMethodDef_RawFastCallKeywords 0x7ffff39d9b13 8 _PyCFunction_FastCallKeywords 0x7ffff39d9d43 9 call_function 0x7ffff3a0c203 10 _PyEval_EvalFrameDefault 0x7ffff3a424ce 11 _PyFunction_FastCallKeywords 0x7ffff39fa2d2 12 call_function 0x7ffff3a0c0ef 13 _PyEval_EvalFrameDefault 0x7ffff3a424ce 14 _PyEval_EvalCodeWithName 0x7ffff39f9430 15 _PyFunction_FastCallDict 0x7ffff39fab0e 16 bpy_class_call bpy_rna.c 8505 0x34f64c1 17 rna_operator_execute_cb rna_wm.c 1325 0x34bbe65 18 wm_operator_exec wm_event_system.c 986 0x2e902b0 19 WM_operator_repeat wm_event_system.c 1062 0x2e9057f 20 ED_undo_operator_repeat ed_undo.c 595 0x3973c4c ``` @Imaginer: is this something you can look into? [if this is some fault in the py API this should be fixed as well, but maybe there is a workaround?]
Member

@lichtwerk Yep, I'll look into all this. Thanks for letting me know.

@lichtwerk Yep, I'll look into all this. Thanks for letting me know.
Ryan Inch was assigned by Brendon Murphy 2020-04-16 01:17:12 +02:00
Member

@lichtwerk It's not a exactly a fault of the python API see https://docs.blender.org/api/blender2.8/info_gotcha.html#help-my-script-crashes-blender
The cause of this crash is because I store references to LayerCollections in a dictionary. I'm pretty sure Adjust Last Operation triggers a reallocation of memory and so then blender tries to access invalid memory locations and crashes.

Now I know this is technically a bad idea, but the reason I do this is because I need to access attributes stored in LayerCollections and unlike Collections, LayerCollections have no data structure in bpy.data, so my options are to walk through the tree every time I need to access a random LayerCollection (extremely slow) or store references in a dictionary that only gets updated when needed (much faster). I've chosen to store references because I want my addon to be able to work with a large number of collections. Unfortunately it means that bugs like this will occasionally show up, but hopefully it won't be too much of a problem.

The easiest way to fix this is to simply remove the 'REGISTER' option from the View QCD Slot operator; this will cause Adjust Last Operation to ignore it. I should probably remove this option from some of my other operators as well.

I'll commit a fix for this soon.

@lichtwerk It's not a exactly a fault of the python API see https://docs.blender.org/api/blender2.8/info_gotcha.html#help-my-script-crashes-blender The cause of this crash is because I store references to `LayerCollections` in a dictionary. I'm pretty sure `Adjust Last Operation` triggers a reallocation of memory and so then blender tries to access invalid memory locations and crashes. Now I know this is technically a bad idea, but the reason I do this is because I need to access attributes stored in `LayerCollections` and unlike `Collections`, `LayerCollections` have no data structure in `bpy.data`, so my options are to walk through the tree every time I need to access a random `LayerCollection` (extremely slow) or store references in a dictionary that only gets updated when needed (much faster). I've chosen to store references because I want my addon to be able to work with a large number of collections. Unfortunately it means that bugs like this will occasionally show up, but hopefully it won't be too much of a problem. The easiest way to fix this is to simply remove the `'REGISTER'` option from the `View QCD Slot` operator; this will cause `Adjust Last Operation` to ignore it. I should probably remove this option from some of my other operators as well. I'll commit a fix for this soon.

This issue was referenced by e2fe08f4dc

This issue was referenced by e2fe08f4dccb27976012ad730272e7aa0969ba24

This issue was referenced by d82bdda0cd

This issue was referenced by d82bdda0cdf24ee8312e439f46b0d8f534200b84
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#75738
No description provided.