Page MenuHome

Undo crash after hiding object in edit mode
Closed, ResolvedPublic


System Information
Operating system: Windows 7 X64 SP1
Graphics card: Nvidia Titan X

Blender Version
Broken: blender2.8, 2019-03-08, a0f2923fd821

Worked: (optional)

Short description of error
Blender crashes when the visibility of the selected object is off and "undo" is performed.

Exact steps for others to reproduce the error

  1. create cube(works with existing objects) 2) Select object in object mode 3) Turn on edit mode 4) Hide object with eye symbol (don’t turn off edit mode) 5) Hit Ctrl + z



Event Timeline

Brecht Van Lommel (brecht) renamed this task from Blender 2.8 closes on visibility hidden + Undo to Undo crash after hiding object in edit mode.Mar 11 2019, 4:20 PM
Brecht Van Lommel (brecht) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.

It also crashes when object is in edit mode and the collection it's in is set to hidden.

Brecht Van Lommel (brecht) raised the priority of this task from Confirmed, Medium to Confirmed, High.Mar 14 2019, 7:04 PM

Call stack from T63314:

 	blender.exe!common_strnlen_c<0,unsigned char>(const unsigned char * const string, const unsigned __int64 maximum_count) Line 72	C++
 	blender.exe!common_strnlen_simd<0,1,unsigned char>(const unsigned char * const string, const unsigned __int64 maximum_count) Line 130	C++
 	blender.exe!common_strnlen<0,unsigned char>(const unsigned char * const string, const unsigned __int64 maximum_count) Line 185	C++
 	blender.exe!strnlen(const char * string, unsigned __int64 maximum_count) Line 202	C++
 	blender.exe!__crt_stdio_output::output_processor<char,__crt_stdio_output::string_output_adapter<char>,__crt_stdio_output::standard_base<char,__crt_stdio_output::string_output_adapter<char> > >::type_case_s_compute_narrow_string_length(const int maximum_length, char __formal) Line 2293	C++
 	blender.exe!__crt_stdio_output::output_processor<char,__crt_stdio_output::string_output_adapter<char>,__crt_stdio_output::standard_base<char,__crt_stdio_output::string_output_adapter<char> > >::type_case_s() Line 2279	C++
 	blender.exe!__crt_stdio_output::output_processor<char,__crt_stdio_output::string_output_adapter<char>,__crt_stdio_output::standard_base<char,__crt_stdio_output::string_output_adapter<char> > >::state_case_type() Line 2023	C++
 	blender.exe!__crt_stdio_output::output_processor<char,__crt_stdio_output::string_output_adapter<char>,__crt_stdio_output::standard_base<char,__crt_stdio_output::string_output_adapter<char> > >::process() Line 1668	C++
 	blender.exe!common_vsprintf<__crt_stdio_output::standard_base,char>(const unsigned __int64 options, char * const buffer, const unsigned __int64 buffer_count, const char * const format, __crt_locale_pointers * const locale, char * const arglist) Line 167	C++
 	blender.exe!__stdio_common_vsprintf(unsigned __int64 options, char * buffer, unsigned __int64 buffer_count, const char * format, __crt_locale_pointers * locale, char * arglist) Line 240	C++
 	[External Code]	
>	blender.exe!clg_str_vappendf(CLogStringBuf * cstr, const unsigned char * fmt, unsigned char * args) Line 190	C
 	blender.exe!CLG_logf(CLG_LogType * lg, CLG_Severity severity, const unsigned char * file_line, const unsigned char * fn, const unsigned char * fmt, ...) Line 497	C
 	blender.exe!ED_undo_object_set_active_or_warn(ViewLayer * view_layer, Object * ob, const unsigned char * info, CLG_LogRef * log) Line 665	C
 	blender.exe!mesh_undosys_step_decode(bContext * C, Main * UNUSED_bmain, UndoStep * us_p, int UNUSED_dir) Line 751	C
 	blender.exe!undosys_step_decode(bContext * C, Main * bmain, UndoStack * ustack, UndoStep * us, int dir) Line 198	C
 	blender.exe!BKE_undosys_step_undo_with_data_ex(UndoStack * ustack, bContext * C, UndoStep * us, bool use_skip) Line 665	C
 	blender.exe!BKE_undosys_step_undo_with_data(UndoStack * ustack, bContext * C, UndoStep * us) Line 686	C
 	blender.exe!ed_undo_step(bContext * C, int step, const unsigned char * undoname, ReportList * reports) Line 170	C
 	blender.exe!ED_undo_pop_op(bContext * C, wmOperator * op) Line 268	C
 	blender.exe!ED_undo_operator_repeat(bContext * C, wmOperator * op) Line 486	C
 	blender.exe!ED_undo_operator_repeat_cb_evt(bContext * C, void * arg_op, int UNUSED_arg_event) Line 540	C
 	blender.exe!ui_apply_but_funcs_after(bContext * C) Line 811	C
 	blender.exe!ui_handler_region_menu(bContext * C, const wmEvent * event, void * UNUSED_userdata) Line 10045	C
 	blender.exe!wm_handler_ui_call(bContext * C, wmEventHandler_UI * handler, const wmEvent * event, int always_pass) Line 585	C
 	blender.exe!wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2491	C
 	blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2720	C
 	blender.exe!wm_event_do_handlers(bContext * C) Line 3071	C
 	blender.exe!WM_main(bContext * C) Line 421	C
 	blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 507	C

In Blender2.7 it was not possible to hide an object in edit mode. I don't see why change this behavior now.
For me a solution would be to simply restrict the property to not hiding an object in edit mode.

The crash happens because objects_len in mesh_undosys_step_encode becomes 0 when hiding the single object in edit mode.
And this function was not prepared to handle this case.

And even if this function handle this case, it is necessay to edit the polls that don't allow Global Undo to work in edit mode.

[update: it seems I was investigating this at the same time as @Germano Cavalcante (mano-wii) so there is nothing here that he hasn't mentioned above]

mesh_undosys_step_encode uses only the visible objects in their iterator: BKE_view_layer_array_from_objects_in_edit_mode_unique_data() at some point calls base_is_in_mode which only returns visible bases.

I suspect it may be related with the issue.

I don't think it's possible to reliably prevent an object from getting hidden in edit mode, there are many indirect ways this could happen and preventing them all in the UI or Python API is not practical. An object could also be hidden in one view layer but not another.

It could work to kick an object out of edit mode as soon as it gets hidden everywhere, or at least not consider it to be in edit mode while it's hidden.

This is no longer crashing, closing.