[Bf-blender-cvs] [2775afa] depsgraph_refactor: Fix for nasty Heisenbug(tm): C++ enums can only be used as flag values when the variable is of type int.
Lukas Tönne
noreply at git.blender.org
Wed Jun 4 20:11:09 CEST 2014
Commit: 2775afac8aed21eabef0c2cf6fed69a99a8749a5
Author: Lukas Tönne
Date: Wed Jun 4 20:01:16 2014 +0200
https://developer.blender.org/rB2775afac8aed21eabef0c2cf6fed69a99a8749a5
Fix for nasty Heisenbug(tm): C++ enums can only be used as flag values
when the variable is of type int.
With short etc. any concatenation ("|" operator) of flags will generate
an int, and in this case was overwriting neighboring fields in
OperationDepsNode ("flag" and "done" fields), which was causing havoc
in the scheduler.
Alternatively a specialized flag type can be defined. See here for
further info on the issue:
http://stackoverflow.com/questions/1448396/how-to-use-enums-as-flags-in-c
===================================================================
M source/blender/depsgraph/intern/depsgraph_eval.h
M source/blender/depsgraph/intern/depsnode_operation.h
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.h b/source/blender/depsgraph/intern/depsgraph_eval.h
index 912fe4f..afb237d 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.h
+++ b/source/blender/depsgraph/intern/depsgraph_eval.h
@@ -56,7 +56,7 @@ typedef struct DEG_OperationsContext {
int type; /* (eDepsNode_Type.OuterNodes) component type <-> context type (for debug purposes) */
short utype; /* (eDEG_OperationContext_UserType) evaluation user type */
- short flag; /* (eDEG_OperationContext_Flag) extra settings */
+ int flag; /* (eDEG_OperationContext_Flag) extra settings */
} DEG_OperationsContext;
/* Settings */
diff --git a/source/blender/depsgraph/intern/depsnode_operation.h b/source/blender/depsgraph/intern/depsnode_operation.h
index dfbf54d..67a7455 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.h
+++ b/source/blender/depsgraph/intern/depsnode_operation.h
@@ -81,8 +81,8 @@ struct OperationDepsNode : public DepsNode {
bool scheduled;
short optype; /* (eDepsOperation_Type) stage of evaluation */
- short flag; /* (eDepsOperation_Flag) extra settings affecting evaluation */
- short done; /* generic tag for traversal algorithms */
+ int flag; /* (eDepsOperation_Flag) extra settings affecting evaluation */
+ int done; /* generic tag for traversal algorithms */
};
/* Macros for common static typeinfo */
More information about the Bf-blender-cvs
mailing list