diff options
author | Julian Eisel <julian@blender.org> | 2022-01-14 20:35:14 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-01-14 21:26:04 +0300 |
commit | ca9a749b21e6048845ca1401ba73c023dda68340 (patch) | |
tree | e61087aeb24201ef0be74d0a4854ab7972ffe6db /source/blender/editors/space_outliner/outliner_intern.hh | |
parent | e9a43a3b6060b57b75e42f27c288608352f000ea (diff) |
Cleanup: Use smart pointers for Outliner tree display and element types
Smart pointers should be the default choice for C++ owning pointers,
since they let you manage memory using RAII.
Also moved type factory methods into static class functions.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_intern.hh')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.hh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_intern.hh b/source/blender/editors/space_outliner/outliner_intern.hh index 880d0bd7fb1..bc6eedb7620 100644 --- a/source/blender/editors/space_outliner/outliner_intern.hh +++ b/source/blender/editors/space_outliner/outliner_intern.hh @@ -23,6 +23,8 @@ #pragma once +#include <memory> + #include "RNA_types.h" #ifdef __cplusplus @@ -55,7 +57,7 @@ class AbstractTreeElement; struct SpaceOutliner_Runtime { /** Object to create and manage the tree for a specific display type (View Layers, Scenes, * Blender File, etc.). */ - blender::ed::outliner::AbstractTreeDisplay *tree_display; + std::unique_ptr<blender::ed::outliner::AbstractTreeDisplay> tree_display; /** Pointers to tree-store elements, grouped by `(id, type, nr)` * in hash-table for faster searching. */ @@ -91,7 +93,7 @@ typedef struct TreeElement { * #TreeElement. Step by step, data should be moved to it and operations based on the type should * become virtual methods of the class hierarchy. */ - blender::ed::outliner::AbstractTreeElement *type; + std::unique_ptr<blender::ed::outliner::AbstractTreeElement> type; ListBase subtree; int xs, ys; /* Do selection. */ |