[Bf-blender-cvs] [e2fdbf75990] master: Fix T64407: crash adding workspace after appending datablock

Brecht Van Lommel noreply at git.blender.org
Mon May 13 22:21:03 CEST 2019


Commit: e2fdbf75990f8baf8676ad7cf71e6176a82efbf1
Author: Brecht Van Lommel
Date:   Mon May 13 22:18:11 2019 +0200
Branches: master
https://developer.blender.org/rBe2fdbf75990f8baf8676ad7cf71e6176a82efbf1

Fix T64407: crash adding workspace after appending datablock

The files operator property should not be remembered for next
operator executions, gives unexpected effects when using the
operator again.

===================================================================

M	source/blender/editors/screen/workspace_edit.c
M	source/blender/windowmanager/intern/wm_operator_props.c

===================================================================

diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index 2dfa05cf6b0..863e3a15120 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -373,13 +373,15 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op)
         &bmain->workspaces, idname, offsetof(ID, name) + 2);
     BLI_assert(appended_workspace != NULL);
 
-    /* Reorder to last position. */
-    BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
+    if (appended_workspace) {
+      /* Reorder to last position. */
+      BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
 
-    /* Changing workspace changes context. Do delayed! */
-    WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
+      /* Changing workspace changes context. Do delayed! */
+      WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
 
-    return OPERATOR_FINISHED;
+      return OPERATOR_FINISHED;
+    }
   }
 
   return OPERATOR_CANCELLED;
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index db1f9a32935..3ad7247d993 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -94,7 +94,9 @@ void WM_operator_properties_filesel(wmOperatorType *ot,
   }
 
   if (flag & WM_FILESEL_FILES) {
-    RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
+    prop = RNA_def_collection_runtime(
+        ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
+    RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
   }
 
   if (action == FILE_SAVE) {



More information about the Bf-blender-cvs mailing list