* Bug #12219 fixed - delete("all") does not recreate a basic axe within cleaned figure.
+* Bug #12232 fixed - There were several memleaks in various fillers.
+
Changes between version 5.3.3 and 5.4.0
=======================================
return;
}
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
-
getGraphicObjectProperty(id, __GO_COLOR_FLAG__, jni_int, (void**) &piColorFlag);
-
getGraphicObjectProperty(id, __GO_DATA_MAPPING__, jni_int, (void**) &piDataMapping);
/* Do not fill */
return;
}
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
+
if (numColors == numGons*numVerticesPerGon)
{
perVertex = 1;
colors, colorFlag, perVertex, dataMapping, numGons, numVerticesPerGon);
}
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
}
void Fac3DDecomposer::fillNormalizedZColorsTextureCoordinates(float* buffer, int bufferLength, double* colormap, int colormapSize,
}
}
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
+
return bufferLength;
}
else
k += 4;
}
}
+
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
+
return bufferLength;
}
else
{
decomposer->fillDirectGridColors(buffer, bufferLength, elementsSize, colormap, colormapSize, z, numX, numY);
}
+
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
}
int NgonGridGrayplotDataDecomposer::fillIndices(char* id, int* buffer, int bufferLength, int logMask)
* because Matplot vertex coordinates are directly computed from these values.
*/
decomposer->fillGridVertices(buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask, (double*) xTrans, (double*) yTrans, &zShift, numX, numY);
+
+ releaseGraphicObjectProperty(__GO_MATPLOT_SCALE__, matplotScale, jni_double_vector, 0);
+ releaseGraphicObjectProperty(__GO_MATPLOT_TRANSLATE__, matplotTranslate, jni_double_vector, 0);
}
/* To do: refactor with its parent class' same method */
void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLength, int elementsSize, int coordinateMask, double* scale, double* translation, int logMask,
- double* x, double* y, double* z, int numX, int numY)
+ double* x, double* y, double* z, int numX, int numY)
{
double xi = 0.;
double yj = 0.;
getGraphicObjectProperty(id, __GO_PARENT_FIGURE__, jni_string, (void**) &parentFigure);
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
-
getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_X__, jni_int, (void**) &piNumX);
getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_Y__, jni_int, (void**) &piNumY);
return;
}
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
+
#if PER_VERTEX_VALUES
for (int j = 0; j < numY-1; j++)
{
}
#endif
+
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
}
/*
}
void Plot3DDecomposer::getFacetTriangles(double* x, double* y, double* z, int numX, int numY, int i, int j,
- int* facetVertexIndices, int* triangleVertexIndices)
+ int* facetVertexIndices, int* triangleVertexIndices)
{
double vertices[4][3];
getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
decomposer->fillNormalizedZGridColors(buffer, bufferLength, elementsSize, colormap, colormapSize, z, numX, numY);
+
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
}
int Plot3DDecomposer::fillIndices(char* id, int* buffer, int bufferLength, int logMask)
}
getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_ELEMENTS__, jni_int, (void**) &piNPoints);
- getGraphicObjectProperty(id, __GO_INTERP_COLOR_VECTOR__, jni_int_vector, (void**) &interpColorVector);
-
getGraphicObjectProperty(id, __GO_PARENT__, jni_string, (void**) &parent);
/* Temporary: to avoid getting a null parent_figure property when the object is built */
return;
}
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
-
/*
* The interpolated color vector is a 3- or 4-element vector.
* However, if nPoints is greater than 4, we choose to output
return;
}
+ getGraphicObjectProperty(id, __GO_INTERP_COLOR_VECTOR__, jni_int_vector, (void**) &interpColorVector);
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
+
if (nPoints > 4)
{
nPoints = 4;
bufferOffset += elementsSize;
}
+
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
+ releaseGraphicObjectProperty(__GO_INTERP_COLOR_VECTOR__, interpColorVector, jni_int_vector, 0);
}
void PolylineDecomposer::fillTextureCoordinates(char* id, float* buffer, int bufferLength)
}
getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_ELEMENTS__, jni_int, (void**) &piNPoints);
- getGraphicObjectProperty(id, __GO_INTERP_COLOR_VECTOR__, jni_int_vector, (void**) &interpColorVector);
-
getGraphicObjectProperty(id, __GO_PARENT__, jni_string, (void**) &parent);
/* Temporary: to avoid getting a null parent_figure property when the object is built */
return;
}
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
- getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
-
/*
* The interpolated color vector is a 3- or 4-element vector.
* However, if nPoints is greater than 4, we choose to output
return;
}
+ getGraphicObjectProperty(id, __GO_INTERP_COLOR_VECTOR__, jni_int_vector, (void**) &interpColorVector);
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
+ getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
+
if (nPoints > 4)
{
nPoints = 4;
bufferOffset += 4;
}
+
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
+ releaseGraphicObjectProperty(__GO_INTERP_COLOR_VECTOR__, interpColorVector, jni_int_vector, 0);
}
/*
colorsNumber = (double) colormapSize;
}
+ releaseGraphicObjectProperty(__GO_COLOR_RANGE__, colorRange, jni_int_vector, 0);
+
/** To take into account the presence of exterior colors:
* - We add 2 to the number of colors.
* - We skip the first color.
computeMinMaxValues(values, numVertices, &minValue, &maxValue);
}
+ releaseGraphicObjectProperty(__GO_Z_BOUNDS__, zBounds, jni_double_vector, 0);
+
if (maxValue == minValue)
{
for (int i = 0; i < numVertices; i++)
maxColorIndex = colormapSize-1;
}
+ releaseGraphicObjectProperty(__GO_COLOR_RANGE__, colorRange, jni_int_vector, 0);
+
computeMinMaxValues(values, numVertices, &minValue, &maxValue);
/* Z-bounds are not taken into account if either of them is invalid */
}
}
+ releaseGraphicObjectProperty(__GO_Z_BOUNDS__, zBounds, jni_double_vector, 0);
+
/* To be verified (when reverse z bounds are specified) */
if (DecompositionUtils::getAbsoluteValue(maxValue - minValue) < DecompositionUtils::getMinDoubleValue())
{
}
}
+ releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
}
void TriangleMeshFecDataDecomposer::computeMinMaxValues(double* values, int numValues, double* valueMin, double* valueMax)
#include "getGraphicObjectProperty.h"
#include "graphicObjectProperties.h"
#include "getScilabJavaVM.h"
+#include <stdio.h>
}
#include "CallGraphicController.hxx"
|| _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
|| _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
|| _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
- )
+ )
{
DataController::getGraphicObjectProperty(_pstID, _iName, _pvData);
return;
{
switch (_returnType)
{
- case jni_string:
- {
- *(_pvData) = CallGraphicController::getGraphicObjectPropertyAsString(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- case jni_string_vector:
- {
- *_pvData = CallGraphicController::getGraphicObjectPropertyAsStringVector(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- case jni_double:
- {
- ((double *)*_pvData)[0] = (double)CallGraphicController::getGraphicObjectPropertyAsDouble(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- case jni_double_vector:
- {
- *_pvData = CallGraphicController::getGraphicObjectPropertyAsDoubleVector(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- case jni_bool:
- {
- ((int *)*_pvData)[0] = (int)CallGraphicController::getGraphicObjectPropertyAsBoolean(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- case jni_bool_vector:
- {
- *_pvData = CallGraphicController::getGraphicObjectPropertyAsBooleanVector(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- case jni_int:
- {
- ((int *)*_pvData)[0] = CallGraphicController::getGraphicObjectPropertyAsInteger(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- case jni_int_vector:
- {
- *_pvData = CallGraphicController::getGraphicObjectPropertyAsIntegerVector(getScilabJavaVM(), _pstID, _iName);
- return;
- }
- default:
- *_pvData = NULL;
- return;
- }
- }
- catch (std::exception &e)
- {
- e.what();
- // If we have an exception, return null to scilab to manage error.
- *_pvData = NULL;
- return;
- }
-
-}
-
-
-void releaseGraphicObjectProperty(int _iName, void * _pvData, enum _ReturnType_ _returnType, int numElements)
-{
-
- /* All the Data model properties have the DATA_MODEL prefix */
- if (_iName == __GO_DATA_MODEL__)
- {
- // passed by reference, do not free them
- return;
- }
-
- switch (_returnType)
- {
case jni_string:
{
- delete[] (char*) _pvData;
+ *(_pvData) = CallGraphicController::getGraphicObjectPropertyAsString(getScilabJavaVM(), _pstID, _iName);
return;
}
case jni_string_vector:
{
- char** data = (char**) _pvData;
- for (int i = 0; i < numElements; ++i)
- {
- delete[] data[i];
- }
- delete[] data;
+ *_pvData = CallGraphicController::getGraphicObjectPropertyAsStringVector(getScilabJavaVM(), _pstID, _iName);
return;
}
case jni_double:
{
- // passed by value
+ ((double *)*_pvData)[0] = (double)CallGraphicController::getGraphicObjectPropertyAsDouble(getScilabJavaVM(), _pstID, _iName);
return;
}
case jni_double_vector:
{
- delete[] (double*) _pvData;
+ *_pvData = CallGraphicController::getGraphicObjectPropertyAsDoubleVector(getScilabJavaVM(), _pstID, _iName);
return;
}
case jni_bool:
{
- // passed by value
+ ((int *)*_pvData)[0] = (int)CallGraphicController::getGraphicObjectPropertyAsBoolean(getScilabJavaVM(), _pstID, _iName);
return;
}
case jni_bool_vector:
{
- delete[] (int*) _pvData;
+ *_pvData = CallGraphicController::getGraphicObjectPropertyAsBooleanVector(getScilabJavaVM(), _pstID, _iName);
return;
}
case jni_int:
{
- // passed by value
+ ((int *)*_pvData)[0] = CallGraphicController::getGraphicObjectPropertyAsInteger(getScilabJavaVM(), _pstID, _iName);
return;
}
case jni_int_vector:
{
- delete[] (int*) _pvData;
+ *_pvData = CallGraphicController::getGraphicObjectPropertyAsIntegerVector(getScilabJavaVM(), _pstID, _iName);
return;
}
default:
+ *_pvData = NULL;
return;
+ }
+ }
+ catch (std::exception &e)
+ {
+ e.what();
+ // If we have an exception, return null to scilab to manage error.
+ *_pvData = NULL;
+ return;
+ }
+
+}
+
+
+void releaseGraphicObjectProperty(int _iName, void * _pvData, enum _ReturnType_ _returnType, int numElements)
+{
+
+ /* All the Data model properties have the DATA_MODEL prefix */
+ if (_iName == __GO_DATA_MODEL__
+ || _iName == __GO_DATA_MODEL_COORDINATES__
+ || _iName == __GO_DATA_MODEL_X__
+ || _iName == __GO_DATA_MODEL_Y__
+ || _iName == __GO_DATA_MODEL_Z__
+ || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT__
+ || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT__
+ || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT__
+ || _iName == __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__
+ || _iName == __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__
+ || _iName == __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__
+ || _iName == __GO_DATA_MODEL_NUM_ELEMENTS__
+ || _iName == __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__
+ || _iName == __GO_DATA_MODEL_NUM_VERTICES_PER_GON__
+ || _iName == __GO_DATA_MODEL_NUM_GONS__
+ || _iName == __GO_DATA_MODEL_Z_COORDINATES_SET__
+ || _iName == __GO_DATA_MODEL_COLORS__
+ || _iName == __GO_DATA_MODEL_NUM_COLORS__
+ || _iName == __GO_DATA_MODEL_NUM_VERTICES__
+ || _iName == __GO_DATA_MODEL_NUM_INDICES__
+ || _iName == __GO_DATA_MODEL_INDICES__
+ || _iName == __GO_DATA_MODEL_VALUES__
+ || _iName == __GO_DATA_MODEL_FEC_TRIANGLES__
+ || _iName == __GO_DATA_MODEL_NUM_X__
+ || _iName == __GO_DATA_MODEL_NUM_Y__
+ || _iName == __GO_DATA_MODEL_NUM_Z__
+ || _iName == __GO_DATA_MODEL_GRID_SIZE__
+ || _iName == __GO_DATA_MODEL_X_DIMENSIONS__
+ || _iName == __GO_DATA_MODEL_Y_DIMENSIONS__
+ || _iName == __GO_DATA_MODEL_MATPLOT_BOUNDS__
+ || _iName == __GO_DATA_MODEL_MATPLOT_TYPE__
+ )
+ {
+ // passed by reference, do not free them
+ return;
+ }
+
+ switch (_returnType)
+ {
+ case jni_string:
+ {
+ delete[] (char*) _pvData;
+ return;
+ }
+ case jni_string_vector:
+ {
+ char** data = (char**) _pvData;
+ for (int i = 0; i < numElements; ++i)
+ {
+ delete[] data[i];
+ }
+ delete[] data;
+ return;
+ }
+ case jni_double:
+ {
+ // passed by value
+ return;
+ }
+ case jni_double_vector:
+ {
+ delete[] (double*) _pvData;
+ return;
+ }
+ case jni_bool:
+ {
+ // passed by value
+ return;
+ }
+ case jni_bool_vector:
+ {
+ delete[] (int*) _pvData;
+ return;
+ }
+ case jni_int:
+ {
+ // passed by value
+ return;
+ }
+ case jni_int_vector:
+ {
+ delete[] (int*) _pvData;
+ return;
+ }
+ default:
+ return;
}
}