[Bf-blender-cvs] [3b6d7b51528] blender2.8: Docs: Add comments on workspace removal functions

Julian Eisel noreply at git.blender.org
Mon Oct 16 23:20:45 CEST 2017


Commit: 3b6d7b5152896165c9fc27097446895301306afd
Author: Julian Eisel
Date:   Mon Oct 16 23:19:15 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB3b6d7b5152896165c9fc27097446895301306afd

Docs: Add comments on workspace removal functions

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

M	source/blender/blenkernel/intern/workspace.c

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

diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 26df3a1ca8a..ca4c3ebb04e 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -143,6 +143,12 @@ WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
 	return new_workspace;
 }
 
+/**
+ * The function that actually frees the workspace data (not workspace itself). It shouldn't be called
+ * directly, instead #BKE_workspace_remove should be, which calls this through #BKE_libblock_free then.
+ *
+ * Should something like a bke_internal.h be added, this should go there!
+ */
 void BKE_workspace_free(WorkSpace *workspace)
 {
 	for (WorkSpaceDataRelation *relation = workspace->hook_layout_relations.first, *relation_next;
@@ -157,6 +163,13 @@ void BKE_workspace_free(WorkSpace *workspace)
 	BKE_viewrender_free(&workspace->view_render);
 }
 
+/**
+ * Remove \a workspace by freeing itself and its data. This is a higher-level wrapper that
+ * calls #BKE_workspace_free (through #BKE_libblock_free) to free the workspace data, and frees
+ * other data-blocks owned by \a workspace and its layouts (currently that is screens only).
+ *
+ * Always use this to remove (and free) workspaces. Don't free non-ID workspace members here.
+ */
 void BKE_workspace_remove(Main *bmain, WorkSpace *workspace)
 {
 	for (WorkSpaceLayout *layout = workspace->layouts.first, *layout_next; layout; layout = layout_next) {



More information about the Bf-blender-cvs mailing list