Crash when using annotation tool on object hidden in sculpt mode #83013

Closed
opened 2020-11-25 18:44:59 +01:00 by Sebastian · 13 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 451.77

Blender Version
Broken: version:

  • 2.90.0
  • 2.90.1
  • 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: 0f45cab862
  • 2.92.0
    Worked: 2.83.9

Short description of error

  • Open Blender with the default startup scene
  • Select the cube and switch to sculpt mode
  • Hide the cube in the outliner
  • Select the Annotate tool and try to draw
    Blender should crash. However, if the Annotate tool is enabled in sculpt mode and the object is hidden afterwards, it doesn't crash.
**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 451.77 **Blender Version** Broken: version: - 2.90.0 - 2.90.1 - 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: `0f45cab862` - 2.92.0 Worked: 2.83.9 **Short description of error** - Open Blender with the default startup scene - Select the cube and switch to sculpt mode - Hide the cube in the outliner - Select the *Annotate* tool and try to draw Blender should crash. However, if the *Annotate* tool is enabled in sculpt mode and the object is hidden afterwards, it doesn't crash.
Author

Added subscriber: @sebus_93

Added subscriber: @sebus_93

Added subscriber: @rjg

Added subscriber: @rjg

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I can confirm this crash in 2.90.1, 2.91 and 2.92. The versions 2.83.x are not affected.

The object ob is NULL which causes a crash when attempting to use

SculptSession *ss = ob->sculpt;

Stack trace from current master branch e09d0c0d077cff79b55ce32ec5124d5faa73e2e7:

createTransSculpt(bContext * C, TransInfo * t) Lines 53	C
createTransData(bContext * C, TransInfo * t) Lines 1241	C
initTransform(bContext * C, TransInfo * t, wmOperator * op, const wmEvent * event, int mode) Lines 1756	C
transformops_data(bContext * C, wmOperator * op, const wmEvent * event) Lines 394	C
transform_invoke(bContext * C, wmOperator * op, const wmEvent * event) Lines 510	C
wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Lines 1296	C
wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties, const unsigned char * kmi_idname) Lines 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) Lines 2451	C
wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Lines 2748	C
wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Lines 2872	C
wm_event_do_handlers(bContext * C) Lines 3368	C
WM_main(bContext * C) Lines 638	C
main(int argc, const unsigned char * * UNUSED_argv_c) Lines 526	C
I can confirm this crash in 2.90.1, 2.91 and 2.92. The versions 2.83.x are not affected. The object `ob` is `NULL` which causes a crash when attempting to use ``` SculptSession *ss = ob->sculpt; ``` Stack trace from current master branch `e09d0c0d077cff79b55ce32ec5124d5faa73e2e7`: ```lines createTransSculpt(bContext * C, TransInfo * t) Lines 53 C createTransData(bContext * C, TransInfo * t) Lines 1241 C initTransform(bContext * C, TransInfo * t, wmOperator * op, const wmEvent * event, int mode) Lines 1756 C transformops_data(bContext * C, wmOperator * op, const wmEvent * event) Lines 394 C transform_invoke(bContext * C, wmOperator * op, const wmEvent * event) Lines 510 C wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Lines 1296 C wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties, const unsigned char * kmi_idname) Lines 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) Lines 2451 C wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Lines 2748 C wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Lines 2872 C wm_event_do_handlers(bContext * C) Lines 3368 C WM_main(bContext * C) Lines 638 C main(int argc, const unsigned char * * UNUSED_argv_c) Lines 526 C ```
Robert Guetzkow changed title from Crash when i hide an object in sculpt mode and use the Annotation tool to Crash when using annotation tool on object hidden in sculpt mode 2020-11-26 00:44:14 +01:00

Added subscriber: @ce3po

Added subscriber: @ce3po

Added subscriber: @rlneumiller

Added subscriber: @rlneumiller

The following fixes the issue to the extent that it behaves as it does in 2.83.10.
With 2.83.10, when attempting to reproduce this issue, rather than crashing, Annotate has no effect until you exit sculpt mode.

I would consider this to be more of a workaround than a proper fix.

diff --git a/source/blender/editors/transform/transform_convert_sculpt.c b/source/blender/editors/transform/transform_convert_sculpt.c
index 0ac6bd9264f..7a60d05d86c 100644
--- a/source/blender/editors/transform/transform_convert_sculpt.c
+++ b/source/blender/editors/transform/transform_convert_sculpt.c
@@ -50,7 +50,10 @@ void createTransSculpt(bContext *C, TransInfo *t)
   }

   Object *ob = CTX_data_active_object(t->context);
+  if (!ob)
+    return;
   SculptSession *ss = ob->sculpt;
+

   {
     BLI_assert(t->data_container_len == 1);

The following fixes the issue to the extent that it behaves as it does in 2.83.10. With 2.83.10, when attempting to reproduce this issue, rather than crashing, Annotate has no effect until you exit sculpt mode. I would consider this to be more of a workaround than a proper fix. ``` diff --git a/source/blender/editors/transform/transform_convert_sculpt.c b/source/blender/editors/transform/transform_convert_sculpt.c index 0ac6bd9264f..7a60d05d86c 100644 --- a/source/blender/editors/transform/transform_convert_sculpt.c +++ b/source/blender/editors/transform/transform_convert_sculpt.c @@ -50,7 +50,10 @@ void createTransSculpt(bContext *C, TransInfo *t) } Object *ob = CTX_data_active_object(t->context); + if (!ob) + return; SculptSession *ss = ob->sculpt; + { BLI_assert(t->data_container_len == 1); ```

Also reproduces with the measure tool.

Also reproduces with the measure tool.
Member

Added subscribers: @ideasman42, @PabloDobarro

Added subscribers: @ideasman42, @PabloDobarro
Member

@ideasman42 This is crashing because when hiding the object, the UI switches to Object mode and the SculptSession is freed, but the object keeps being in Sculpt Mode. Any operation that checks the active mode of that object will behave in an unexpected way. What is the reason for doing this when changing the visibility?
If this is related to not supporting multi object editing in paint modes, I think it makes more sense to prevent the visibility of the active object from being changed.
Also, this is also no consistent with other visibility changes. If you hide the object directy, it goes from Sculpt Mode to Object Mode, but it you hide the collection that contains that object, it stays in Sculpt Mode.

@ideasman42 This is crashing because when hiding the object, the UI switches to Object mode and the SculptSession is freed, but the object keeps being in Sculpt Mode. Any operation that checks the active mode of that object will behave in an unexpected way. What is the reason for doing this when changing the visibility? If this is related to not supporting multi object editing in paint modes, I think it makes more sense to prevent the visibility of the active object from being changed. Also, this is also no consistent with other visibility changes. If you hide the object directy, it goes from Sculpt Mode to Object Mode, but it you hide the collection that contains that object, it stays in Sculpt Mode.

@PabloDobarro agree this is not consistent / useful behavior.

As far as I know this was not intentionally designed this way it's just the result of the contexts active_object returning NULL when an object is hidden in the 3D view.

I've created as design task to address this #85532 (Proposal to change behavior when the active object is hidden)


For 2.92 I'll check on a short term fix.

@PabloDobarro agree this is not consistent / useful behavior. As far as I know this was not intentionally designed this way it's just the result of the contexts `active_object` returning NULL when an object is hidden in the 3D view. I've created as design task to address this #85532 (Proposal to change behavior when the active object is hidden) ----- For 2.92 I'll check on a short term fix.

This issue was referenced by 52cfc620c8

This issue was referenced by 52cfc620c8cc3125282d8dd66df312ffb576569c

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2021-02-11 02:40:04 +01:00
Thomas Dinges added this to the 2.92 milestone 2023-02-08 16:15:38 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 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#83013
No description provided.