forked from bartvdbraak/blender
Fix T46848: more OpenNL crashes due to uninitialized variables.
This commit is contained in:
parent
d4ad89c1ee
commit
b2a4aab9e4
@ -57,17 +57,28 @@ typedef Eigen::Triplet<double> EigenTriplet;
|
|||||||
|
|
||||||
/* NLContext data structure */
|
/* NLContext data structure */
|
||||||
|
|
||||||
typedef struct {
|
struct NLCoeff {
|
||||||
|
NLCoeff()
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
value = 0.0;
|
||||||
|
}
|
||||||
NLuint index;
|
NLuint index;
|
||||||
NLdouble value;
|
NLdouble value;
|
||||||
} NLCoeff;
|
};
|
||||||
|
|
||||||
typedef struct {
|
struct NLVariable {
|
||||||
|
NLVariable()
|
||||||
|
{
|
||||||
|
memset(value, 0, sizeof(value));
|
||||||
|
locked = false;
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
NLdouble value[4];
|
NLdouble value[4];
|
||||||
NLboolean locked;
|
NLboolean locked;
|
||||||
NLuint index;
|
NLuint index;
|
||||||
std::vector<NLCoeff> a;
|
std::vector<NLCoeff> a;
|
||||||
} NLVariable;
|
};
|
||||||
|
|
||||||
#define NL_STATE_INITIAL 0
|
#define NL_STATE_INITIAL 0
|
||||||
#define NL_STATE_SYSTEM 1
|
#define NL_STATE_SYSTEM 1
|
||||||
@ -340,7 +351,9 @@ void nlMatrixAdd(NLContext *context, NLuint row, NLuint col, NLdouble value)
|
|||||||
if(!context->least_squares)
|
if(!context->least_squares)
|
||||||
row = context->variable[row].index;
|
row = context->variable[row].index;
|
||||||
|
|
||||||
NLCoeff coeff = {row, value};
|
NLCoeff coeff;
|
||||||
|
coeff.index = row;
|
||||||
|
coeff.value = value;
|
||||||
context->variable[col].a.push_back(coeff);
|
context->variable[col].a.push_back(coeff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user