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.
This commit is contained in:
Brecht Van Lommel 2019-05-13 22:18:11 +02:00
parent 164fafdcb0
commit e2fdbf7599
Notes: blender-bot 2023-02-14 06:00:45 +01:00
Referenced by issue #64407, Crash when adding Workspace after appending Brushes
2 changed files with 10 additions and 6 deletions

View File

@ -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;

View File

@ -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) {