Page MenuHome

Using undo after adding an object in edit mode to an object hidden in viewport causes a crash
Open, Confirmed, MediumPublic

Description

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 1060 3GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 399.24

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash: rB26bd5ebd42e3
Worked: (optional)

Short description of error
[Crash in one step.]

Exact steps for others to reproduce the error
[Object Mode→Edit Mode→Add something object→Hide in Viewport the object→Add another→Undo→Blender crashes]

Details

Type
Bug

Event Timeline

IKU (IKU) created this task.Sun, Dec 1, 8:18 PM
Maciej Jutrzenka (Kramon) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Sun, Dec 1, 8:26 PM

tried selever times both on linux and windows 10 can't reproduce.. can u make short video showing this? i might reproduce wrongly the steps

Maciej Jutrzenka (Kramon) renamed this task from Crush report to Hide object while editing. UNDO crash.Sun, Dec 1, 8:26 PM
Robert Guetzkow (rjg) renamed this task from Hide object while editing. UNDO crash to Hide object while editing followed by UNDO causes crash.Sun, Dec 1, 11:48 PM
Robert Guetzkow (rjg) raised the priority of this task from Needs Information from User to Confirmed, Medium.

I can reproduce this issue on Windows. The crash is caused by the attempt to print the warning in ED_undo_object_set_active_or_warn(). The following stack trace was created from a build of rBf0e7fd4ad62ec1dd5c9632050a8fde347c28656f

ucrtbased.dll
vsnprintf(unsigned char * const _Buffer, const unsigned __int64 _BufferCount, const unsigned char * const _Format, unsigned char * _ArgList) Line 1440
clg_str_vappendf(CLogStringBuf * cstr, const unsigned char * fmt, unsigned char * args) Line 190
CLG_logf(CLG_LogType * lg, CLG_Severity severity, const unsigned char * file_line, const unsigned char * fn, const unsigned char * fmt, ...) Line 504
ED_undo_object_set_active_or_warn(ViewLayer * view_layer, Object * ob, const unsigned char * info, CLG_LogRef * log) Line 737
mesh_undosys_step_decode(bContext * C, Main * bmain, UndoStep * us_p, int UNUSED_dir, bool UNUSED_is_final) Line 778
undosys_step_decode(bContext * C, Main * bmain, UndoStack * ustack, UndoStep * us, int dir, bool is_final) Line 210
BKE_undosys_step_undo_with_data_ex(UndoStack * ustack, bContext * C, UndoStep * us, bool use_skip) Line 685
BKE_undosys_step_undo_with_data(UndoStack * ustack, bContext * C, UndoStep * us) Line 720
BKE_undosys_step_undo(UndoStack * ustack, bContext * C) Line 725
ed_undo_step_impl(bContext * C, int step, const unsigned char * undoname, int undo_index, ReportList * reports) Line 191
ed_undo_step_direction(bContext * C, int step, ReportList * reports) Line 254
ed_undo_exec(bContext * C, wmOperator * op) Line 389
wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1453
wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties) Line 2281
wm_handlers_do_keymap_with_keymap_handler(bContext * C, wmEvent * event, ListBase * handlers, wmEventHandler_Keymap * handler, wmKeyMap * keymap, const bool do_debug_handler) Line 2594
wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2731
wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2993
wm_event_do_handlers(bContext * C) Line 3480
WM_main(bContext * C) Line 420
main(int argc, const unsigned char * * UNUSED_argv_c) Line 498
Robert Guetzkow (rjg) renamed this task from Hide object while editing followed by UNDO causes crash to Using undo after adding an object in edit mode to an object hidden in viewport causes a crash.Sun, Dec 1, 11:54 PM

Issue happens in mesh_undosys_step_decode because us->elems / us->elems_len is empty. It is empty because hidden objects are not added to MeshUndoStep (in this case it is currently selected object).

I have implemented initial solution that disables hiding object when it is in edit mode, but it is still not a complete solution (need feedback from someone with better knowledge of internals):

  • Now user can still go into edit mode and press hide icon on whole collection - disabling hide button for collection will be very unituitive to user in this case
  • Should we also disallow python script to hide object in such case
  • Maybe there is some other way to hide object I don`t know (that should be fixed)

I have implemented initial solution that disables hiding object when it is in edit mode.

I don't think that's a desired solution. Doing the same steps above for bones gives a warning but not a crash, so it should be possible to do undo for meshes without a crash.

Also, you might find the intro into how to submit a patch useful: https://wiki.blender.org/wiki/Process/Contributing_Code

From how blender works it seems to me that disabling "Hide object" while you are editing it is most logical solution.

Which of those do you think would be desired solution:

  1. Disable hiding object while it is in edit mode (as if you hide an object edit mode dissapears)
  2. Record object hiding action to undo history log (now it is not done) - second best solution to my mind
  3. Rewrite how undo history is recorded to support hidden objects (worst solution I think)
  4. ? Offer something else maybe