Crash on deleting current workspace from the outliner #75489

Closed
opened 2020-04-07 16:22:52 +02:00 by Bent Hillerkus · 14 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75

Blender Version
Broken: version: 2.83 (sub 12), branch: master, commit date: 2020-04-07 11:44, hash: 6feeede47f
Worked: technically 2.79b

Short description of error
You can use the outliner to delete workspace data. When you delete the workspace you are currently in Blender will crash.
I understand that this is something you have to provoke, but I guess that this could be handled a bit more gracefully

Exact steps for others to reproduce the error

  • Set the display mode in the outliner to "Blender File"
  • Twirl out "Workspaces"
  • Delete the one you are currently in
**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.75 **Blender Version** Broken: version: 2.83 (sub 12), branch: master, commit date: 2020-04-07 11:44, hash: `6feeede47f` Worked: technically 2.79b **Short description of error** You can use the outliner to delete workspace data. When you delete the workspace you are currently in Blender will crash. I understand that this is something you have to provoke, but I guess that this could be handled a bit more gracefully **Exact steps for others to reproduce the error** - Set the display mode in the outliner to "Blender File" - Twirl out "Workspaces" - Delete the one you are currently in
Author

Added subscriber: @bent

Added subscriber: @bent
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

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

Confirmed, checking...

Confirmed, checking...
Philipp Oeser changed title from Crash on deleting current workspace to Crash on deleting current workspace from the outliner 2020-04-07 16:29:44 +02:00
Member

Added subscribers: @JulianEisel, @mont29

Added subscribers: @JulianEisel, @mont29
Member

Seems like the screen is already invalid (WM_window_get_active_screen, CTX_wm_screen return NULL), while the workspace is still valid (WM_window_get_active_workspace still gets the only just deleted...)

1 ED_screen_do_listen   screen_edit.c     440 0x3549f9b 
2 wm_event_do_notifiers wm_event_system.c 521 0x2ea82b9 
3 WM_main               wm.c              453 0x2ea3b04 
4 main                  creator.c         524 0x2a63259 

Not sure exactly how to do this, but instead of the generic BKE_id_delete, we would need the functionality of ED_workspace_delete [doing it properly with ED_workspace_change etc...]

I could dig some more, but maybe @mont29, @JulianEisel know right away?

Seems like the screen is already invalid (`WM_window_get_active_screen`, `CTX_wm_screen` return NULL), while the workspace is still valid (`WM_window_get_active_workspace` still gets the only just deleted...) ``` 1 ED_screen_do_listen screen_edit.c 440 0x3549f9b 2 wm_event_do_notifiers wm_event_system.c 521 0x2ea82b9 3 WM_main wm.c 453 0x2ea3b04 4 main creator.c 524 0x2a63259 ``` Not sure exactly how to do this, but instead of the generic `BKE_id_delete`, we would need the functionality of `ED_workspace_delete` [doing it properly with `ED_workspace_change` etc...] I could dig some more, but maybe @mont29, @JulianEisel know right away?

Added subscriber: @brecht

Added subscriber: @brecht

Deleting a workspace that is in use should just not be allowed I think,

Deleting a workspace that is in use should just not be allowed I think,
Member

In #75489#905563, @brecht wrote:
Deleting a workspace that is in use should just not be allowed I think,

(works if you do it from the workspace tab context menu directly -- just not in the outliner...)

> In #75489#905563, @brecht wrote: > Deleting a workspace that is in use should just not be allowed I think, (works if you do it from the workspace tab context menu directly -- just not in the outliner...)

Right, but the workspace tab menu will change to another workspace first, and also will do nothing if there is only a single workspace.

For low-level access through the outliner or API I think we should only delete or refuse to delete, not change the active workspace.

Right, but the workspace tab menu will change to another workspace first, and also will do nothing if there is only a single workspace. For low-level access through the outliner or API I think we should only delete or refuse to delete, not change the active workspace.
Member

I propose this as a simple fix: P1333: Possible fix for #75489

diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 60e6b423720..3ae100b6209 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -54,6 +54,7 @@
 #include "BKE_outliner_treehash.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
+#include "BKE_workspace.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
@@ -473,6 +474,14 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto
                 id->name);
     return;
   }
+  else if (te->idcode == ID_WS) {
+    BKE_workspace_id_tag_all_visible(bmain, LIB_TAG_DOIT);
+    if (id->tag & LIB_TAG_DOIT) {
+      BKE_reportf(
+          reports, RPT_WARNING, "Cannot delete currently visible workspace id '%s'", id->name);
+      return;
+    }
+  }
 
   BKE_id_delete(bmain, id);
 

I don't want it to fail silently but give an error message, so this seemed like the best place to do that without bigger changes.

I propose this as a simple fix: [P1333: Possible fix for #75489](https://archive.blender.org/developer/P1333.txt) ``` diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 60e6b423720..3ae100b6209 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -54,6 +54,7 @@ #include "BKE_outliner_treehash.h" #include "BKE_report.h" #include "BKE_scene.h" +#include "BKE_workspace.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -473,6 +474,14 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto id->name); return; } + else if (te->idcode == ID_WS) { + BKE_workspace_id_tag_all_visible(bmain, LIB_TAG_DOIT); + if (id->tag & LIB_TAG_DOIT) { + BKE_reportf( + reports, RPT_WARNING, "Cannot delete currently visible workspace id '%s'", id->name); + return; + } + } BKE_id_delete(bmain, id); ``` I don't want it to fail silently but give an error message, so this seemed like the best place to do that without bigger changes.

@JulianEisel that fix looks good to me.

@JulianEisel that fix looks good to me.

This issue was referenced by d216a0b505

This issue was referenced by d216a0b505735da432448c438982b5cac1cba9ee
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Julian Eisel self-assigned this 2020-04-10 17:31:03 +02: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
6 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#75489
No description provided.