Page MenuHome

Crash with curve brush in sculpt mode
Closed, ResolvedPublicBUG

Description

System Information
Operating system: win 10
Graphics card: rtx 2080ti

Caused by rBa584aef4703a: Undo: Further tweak/fixes the 'use context' flag of undo types.

Blender Version
Broken:

  • 2.93.0 Alpha, branch: master, commit date: 2021-01-15 01:23, hash: rB04572f0899f5
  • 2.92.0 Alpha, branch: master, commit date: 2021-01-12 20:03, hash: rB719bea0d6d06
  • 2.92.0 Alpha, branch: master, commit date: 2021-01-07 22:28, hash: rB61f1faac3f21
  • 2.92.0 Alpha, branch: master, commit date: 2021-01-05 20:21, hash: rB5424b4821d28

Worked:

  • 2.92.0 Alpha, branch: master, commit date: 2021-01-05 20:21, hash: rB5424b4821d28
    • Triggers an assert in debug builds, wm_event_do_handlers triggers BLI_assert(ED_undo_is_state_valid(C));
  • 2.91 (? - might also just mask the issue in a release build)

Short description of error

In sculpt mode, when I use curve brush and Ctrl+RMB click, Blender will crash.

Exact steps for others to reproduce the error

  1. Select an object and switch to Sculpt Mode
  2. Open the sidebar and switch to the Tool tab
  3. Change Stroke > Stroke Method to Curve
  4. Use Ctrl+RMB in the viewport

In factory startup mode , the same thing happens.

Stack trace from 2.93 rB04572f0899f5:

CTX_wm_area(const bContext * C) Line 716	C
CTX_wm_region_view3d(const bContext * C) Line 771	C
paint_curve_poll(bContext * C) Line 58	C
paintcurve_undosys_step_encode(bContext * C, Main * UNUSED_bmain, UndoStep * us_p) Line 107	C
undosys_step_encode(bContext * C, Main * bmain, UndoStack * ustack, UndoStep * us) Line 158	C
BKE_undosys_step_push_with_type(UndoStack * ustack, bContext * C, const unsigned char * name, const UndoType * ut) Line 595	C
BKE_undosys_step_push(UndoStack * ustack, bContext * C, const unsigned char * name) Line 641	C
ED_paintcurve_undo_push_end() Line 184	C
paintcurve_point_add(bContext * C, wmOperator * op, const int * loc) Line 246	C
paintcurve_add_point_invoke(bContext * C, wmOperator * op, const wmEvent * event) Line 253	C
wm_macro_invoke_internal(bContext * C, wmOperator * op, const wmEvent * event, wmOperator * opm) Line 363	C
wm_macro_invoke(bContext * C, wmOperator * op, const wmEvent * event) Line 389	C
wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1300	C
wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties, const unsigned char * kmi_idname) Line 2141	C
wm_handlers_do_keymap_with_keymap_handler(bContext * C, wmEvent * event, ListBase * handlers, wmEventHandler_Keymap * handler, wmKeyMap * keymap, const bool do_debug_handler) Line 2466	C
wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2762	C
wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2886	C
wm_event_do_handlers(bContext * C) Line 3382	C
WM_main(bContext * C) Line 638	C
main(int argc, const unsigned char * * UNUSED_argv_c) Line 526	C

Event Timeline

Robert Guetzkow (rjg) changed the task status from Needs Triage to Confirmed.Jan 15 2021, 11:57 AM
This comment was removed by Robert Guetzkow (rjg).
Robert Guetzkow (rjg) changed the task status from Confirmed to Needs Triage.Jan 15 2021, 11:58 AM
Robert Guetzkow (rjg) renamed this task from blender 2.92,Sculpt mode use curve brush will cause a crash. to Crash with curve brush in sculpt mode.Jan 15 2021, 12:07 PM
Robert Guetzkow (rjg) changed the task status from Needs Triage to Confirmed.
Robert Guetzkow (rjg) triaged this task as High priority.
Robert Guetzkow (rjg) updated the task description. (Show Details)
Robert Guetzkow (rjg) edited projects, added BF Blender (2.92); removed BF Blender.

I will bisect this shortly.

Is there anything I can do for you?
To be honest, English is not my first language, so I'm not sure what's going on.

@zms1992 (15562300165) There is currently nothing that you can do to help. I can reproduce the issue on my system and now one of our developers as to identify the exact cause and implement a patch.

I see. Will there be an update as soon as the fix is completed?

When there is a patch, it will have to go through review and once it is approved it will be included in the versions currently under development. Once these new versions of Blender are released you will access to a Blender that includes the patch. You will then have to manually download and install the new release as Blender doesn't automatically update. I hope that answers your question?

Yes,i get it.

Thanks a lot !

Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

@Philipp Oeser (lichtwerk) There was already an issue prior to that commit, but it seems that another new issue was introduced (see assert triggered in debug builds before the commit you've referenced). We will have to check if that problem still exists after fixing the one introduced by the commit you've identified.

The problem is that context is NULL when calling paint_curve_poll() in paintcurve_undosys_step_encode(). The null-check that existed before seems to be needed. Perhaps the undo system should ensure that, but as the assert in 2021-01-05 20:21, hash: rB5424b4821d28 indicates the undo steps weren't properly created in the first place.

Edit: I've added the null-check back and the assert in wm_event_do_handlers still gets triggered. The problem is likely, with the null-check the undo step doesn't get encoded, without it it attempts to dereference the null-pointer. The next logical step is to see why the context is null in the first place.