Missing null check in outliner_draw.c leads to crash with old userpref.blend #48830

Closed
opened 2016-07-11 21:40:38 +02:00 by Ralf Hölzemer · 4 comments

System Information
system-info.txt

Blender Version
Broken: c06d3b6
Worked: unknown

Short description of error
When using my own userpref.blend, blender crashes when running the "purge all" operator.

Exact steps for others to reproduce the error

  • replace your own userpref with the one attached above
  • open blender, create a cube and then delete it so we have a datablock with no user
  • switch the display type in the outliner to Orphan Data
  • press the Purge All button in the header

outliner_purge_crash.diff
Checking tselem->id before that line as in the patch above seems to work fine in my tests, but I am unsure if this is the correct way to deal with this. Maybe the root of the problem lies somewhere else.

Backtrace

Thread 1 "blender" received signal SIGSEGV, Segmentation fault.
tselem_draw_icon (block=block@entry=0x7fffc321c008, xmax=xmax@entry=167, x=111.099998, y=-43.7999992, te=te@entry=0x7fffc2f71b08, alpha=alpha@entry=0.5, tselem=0x7fffcef56070, tselem=0x7fffcef56070, 
    tselem=0x7fffcef56070) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1243
1243		else if (GS(tselem->id->name) == ID_OB) {
(gdb) bt
#0  tselem_draw_icon (block=block@entry=0x7fffc321c008, xmax=xmax@entry=167, x=111.099998, y=-43.7999992, te=te@entry=0x7fffc2f71b08, alpha=alpha@entry=0.5, tselem=0x7fffcef56070, tselem=0x7fffcef56070, 
    tselem=0x7fffcef56070) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1243
#1  0x0000000000a7a6b2 in outliner_draw_iconrow (C=C@entry=0x7fffd20fae88, block=block@entry=0x7fffc321c008, scene=scene@entry=0x7fffc3151008, soops=soops@entry=0x7fffd1668388, level=level@entry=0, xmax=167, 
    offsx=0x7fffffffde40, ys=-46, lb=0x7fffc2f71570) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1395
#2  0x0000000000a7aeb6 in outliner_draw_tree_element (C=C@entry=0x7fffd20fae88, block=block@entry=0x7fffc321c008, fstyle=fstyle@entry=0x7fffcef80db8, scene=scene@entry=0x7fffc3151008, 
    ar=ar@entry=0x7fffcef3d948, soops=soops@entry=0x7fffd1668388, te=0x7fffc2f71558, startx=0, starty=0x7fffffffdef4, te_edit=0x7fffffffdef8)
    at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1625
#3  0x0000000000a7cd65 in outliner_draw_tree (te_edit=0x7fffffffdef8, soops=0x7fffd1668388, ar=0x7fffcef3d948, scene=0x7fffc3151008, block=0x7fffc321c008, C=0x7fffd20fae88)
    at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1762
- 4  draw_outliner (C=C@entry=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1882
- 5  0x0000000000a77bd7 in outliner_main_region_draw (C=0x7fffd20fae88, ar=0x7fffcef3d948) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/space_outliner.c:278
- 6  0x0000000000cac7a7 in ED_region_do_draw (C=C@entry=0x7fffd20fae88, ar=ar@entry=0x7fffcef3d948) at /home/ralf/Source/blender/blender/source/blender/editors/screen/area.c:518
- 7  0x00000000009eccb4 in wm_method_draw_triple (win=0x7fffceec9288, C=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/windowmanager/intern/wm_draw.c:557
- 8  wm_draw_update (C=C@entry=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/windowmanager/intern/wm_draw.c:959
- 9  0x00000000009e8478 in WM_main (C=C@entry=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/windowmanager/intern/wm.c:495
#10 0x00000000009c61c9 in main (argc=1, argv=0x7fffffffe1d8) at /home/ralf/Source/blender/blender/source/creator/creator.c:521
(gdb) list
1238					break;
1239				default:
1240					UI_icon_draw(x, y, ICON_DOT); break;
1241			}
1242		}
1243		else if (GS(tselem->id->name) == ID_OB) {
1244			Object *ob = (Object *)tselem->id;
1245			switch (ob->type) {
1246				case OB_LAMP:
1247					tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LAMP); break;
(gdb) print tselem->id
$1 = (struct ID *) 0x0
(gdb) print tselem->id->name
Cannot access memory at address 0x20
**System Information** [system-info.txt](https://archive.blender.org/developer/F321689/system-info.txt) **Blender Version** Broken: c06d3b6 Worked: unknown **Short description of error** When using my own [userpref.blend](https://archive.blender.org/developer/F321690/userpref.blend), blender crashes when running the "purge all" operator. **Exact steps for others to reproduce the error** - replace your own userpref with the one attached above - open blender, create a cube and then delete it so we have a datablock with no user - switch the display type in the outliner to **Orphan Data** - press the **Purge All** button in the header [outliner_purge_crash.diff](https://archive.blender.org/developer/F321696/outliner_purge_crash.diff) Checking tselem->id before that line as in the patch above seems to work fine in my tests, but I am unsure if this is the correct way to deal with this. Maybe the root of the problem lies somewhere else. **Backtrace** ``` Thread 1 "blender" received signal SIGSEGV, Segmentation fault. tselem_draw_icon (block=block@entry=0x7fffc321c008, xmax=xmax@entry=167, x=111.099998, y=-43.7999992, te=te@entry=0x7fffc2f71b08, alpha=alpha@entry=0.5, tselem=0x7fffcef56070, tselem=0x7fffcef56070, tselem=0x7fffcef56070) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1243 1243 else if (GS(tselem->id->name) == ID_OB) { (gdb) bt #0 tselem_draw_icon (block=block@entry=0x7fffc321c008, xmax=xmax@entry=167, x=111.099998, y=-43.7999992, te=te@entry=0x7fffc2f71b08, alpha=alpha@entry=0.5, tselem=0x7fffcef56070, tselem=0x7fffcef56070, tselem=0x7fffcef56070) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1243 #1 0x0000000000a7a6b2 in outliner_draw_iconrow (C=C@entry=0x7fffd20fae88, block=block@entry=0x7fffc321c008, scene=scene@entry=0x7fffc3151008, soops=soops@entry=0x7fffd1668388, level=level@entry=0, xmax=167, offsx=0x7fffffffde40, ys=-46, lb=0x7fffc2f71570) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1395 #2 0x0000000000a7aeb6 in outliner_draw_tree_element (C=C@entry=0x7fffd20fae88, block=block@entry=0x7fffc321c008, fstyle=fstyle@entry=0x7fffcef80db8, scene=scene@entry=0x7fffc3151008, ar=ar@entry=0x7fffcef3d948, soops=soops@entry=0x7fffd1668388, te=0x7fffc2f71558, startx=0, starty=0x7fffffffdef4, te_edit=0x7fffffffdef8) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1625 #3 0x0000000000a7cd65 in outliner_draw_tree (te_edit=0x7fffffffdef8, soops=0x7fffd1668388, ar=0x7fffcef3d948, scene=0x7fffc3151008, block=0x7fffc321c008, C=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1762 - 4 draw_outliner (C=C@entry=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/outliner_draw.c:1882 - 5 0x0000000000a77bd7 in outliner_main_region_draw (C=0x7fffd20fae88, ar=0x7fffcef3d948) at /home/ralf/Source/blender/blender/source/blender/editors/space_outliner/space_outliner.c:278 - 6 0x0000000000cac7a7 in ED_region_do_draw (C=C@entry=0x7fffd20fae88, ar=ar@entry=0x7fffcef3d948) at /home/ralf/Source/blender/blender/source/blender/editors/screen/area.c:518 - 7 0x00000000009eccb4 in wm_method_draw_triple (win=0x7fffceec9288, C=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/windowmanager/intern/wm_draw.c:557 - 8 wm_draw_update (C=C@entry=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/windowmanager/intern/wm_draw.c:959 - 9 0x00000000009e8478 in WM_main (C=C@entry=0x7fffd20fae88) at /home/ralf/Source/blender/blender/source/blender/windowmanager/intern/wm.c:495 #10 0x00000000009c61c9 in main (argc=1, argv=0x7fffffffe1d8) at /home/ralf/Source/blender/blender/source/creator/creator.c:521 (gdb) list 1238 break; 1239 default: 1240 UI_icon_draw(x, y, ICON_DOT); break; 1241 } 1242 } 1243 else if (GS(tselem->id->name) == ID_OB) { 1244 Object *ob = (Object *)tselem->id; 1245 switch (ob->type) { 1246 case OB_LAMP: 1247 tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LAMP); break; (gdb) print tselem->id $1 = (struct ID *) 0x0 (gdb) print tselem->id->name Cannot access memory at address 0x20 ```
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @cheleb

Added subscriber: @cheleb

This issue was referenced by b8f217ef21

This issue was referenced by b8f217ef213f908a6b5407f162a8f980091e838d

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
3 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#48830
No description provided.