[Bf-blender-cvs] [880258a] master: Fix T46848: OpenNL crash on Windows due to uninintialized variables.
Brecht Van Lommel
noreply at git.blender.org
Mon Nov 23 19:31:03 CET 2015
Commit: 880258a0db0813d6a92a62622fe636c0e189badb
Author: Brecht Van Lommel
Date: Mon Nov 23 18:20:32 2015 +0100
Branches: master
https://developer.blender.org/rB880258a0db0813d6a92a62622fe636c0e189badb
Fix T46848: OpenNL crash on Windows due to uninintialized variables.
===================================================================
M intern/opennl/intern/opennl.cpp
===================================================================
diff --git a/intern/opennl/intern/opennl.cpp b/intern/opennl/intern/opennl.cpp
index 076dce3..446a1a3 100644
--- a/intern/opennl/intern/opennl.cpp
+++ b/intern/opennl/intern/opennl.cpp
@@ -77,6 +77,24 @@ typedef struct {
#define NL_STATE_SYSTEM_SOLVED 5
struct NLContext {
+ NLContext()
+ {
+ state = NL_STATE_INITIAL;
+ n = 0;
+ m = 0;
+ sparse_solver = NULL;
+ nb_variables = 0;
+ nb_rhs = 1;
+ nb_rows = 0;
+ least_squares = false;
+ solve_again = false;
+ }
+
+ ~NLContext()
+ {
+ delete sparse_solver;
+ }
+
NLenum state;
NLuint n;
@@ -103,24 +121,11 @@ struct NLContext {
NLContext *nlNewContext(void)
{
- NLContext* result = new NLContext();
- result->state = NL_STATE_INITIAL;
- result->nb_rhs = 1;
- return result;
+ return new NLContext();
}
void nlDeleteContext(NLContext *context)
{
- context->M.resize(0, 0);
- context->MtM.resize(0, 0);
- context->b.clear();
- context->Mtb.clear();
- context->x.clear();
- context->variable.clear();
-
- delete context->sparse_solver;
- context->sparse_solver = NULL;
-
delete context;
}
More information about the Bf-blender-cvs
mailing list