Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Meel <ankitm>2020-11-17 14:40:03 +0300
committerAnkit Meel <ankitjmeel@gmail.com>2020-11-17 15:03:25 +0300
commit88de58fd1af9ffb1c6afcc53cf6279aadc51f58c (patch)
tree522df7c86107edbabb1631d2e12014bafdc66c4b /source/blender/depsgraph
parent417224a31bb006ac59a7572809cc5976de0eb619 (diff)
Clang-tidy, fix bugprone-exception-escape.
Remove redundant call to `ofstream::close()` from `~PSStrokeRenderer` and `~TextStrokeRenderer`. ofstream will be destructed automatically. - For `~Depsgraph`, `std::function`'s constructor can throw. - Passing throwing statements in the lambda will not be detected by clang-tidy. Fix these issues by using lambda as function argument. Reviewed By: sergey, sybren Differential Revision: https://developer.blender.org/D9497
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc9
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h1
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 870a6d3fce8..17eeba55a27 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -133,9 +133,10 @@ IDNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
return id_node;
}
-void Depsgraph::clear_id_nodes_conditional(const std::function<bool(ID_Type id_type)> &filter)
+template<typename FilterFunc>
+static void clear_id_nodes_conditional(Depsgraph::IDDepsNodes *id_nodes, const FilterFunc &filter)
{
- for (IDNode *id_node : id_nodes) {
+ for (IDNode *id_node : *id_nodes) {
if (id_node->id_cow == nullptr) {
/* This means builder "stole" ownership of the copy-on-written
* datablock for her own dirty needs. */
@@ -156,8 +157,8 @@ void Depsgraph::clear_id_nodes()
/* Free memory used by ID nodes. */
/* Stupid workaround to ensure we free IDs in a proper order. */
- clear_id_nodes_conditional([](ID_Type id_type) { return id_type == ID_SCE; });
- clear_id_nodes_conditional([](ID_Type id_type) { return id_type != ID_PA; });
+ clear_id_nodes_conditional(&id_nodes, [](ID_Type id_type) { return id_type == ID_SCE; });
+ clear_id_nodes_conditional(&id_nodes, [](ID_Type id_type) { return id_type != ID_PA; });
for (IDNode *id_node : id_nodes) {
delete id_node;
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index e03846f81e2..14c91834739 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -73,7 +73,6 @@ struct Depsgraph {
IDNode *find_id_node(const ID *id) const;
IDNode *add_id_node(ID *id, ID *id_cow_hint = nullptr);
void clear_id_nodes();
- void clear_id_nodes_conditional(const std::function<bool(ID_Type id_type)> &filter);
/* Add new relationship between two nodes. */
Relation *add_new_relation(Node *from, Node *to, const char *description, int flags = 0);