diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2006-05-31 06:30:53 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2006-05-31 06:30:53 +0000 |
| commit | 327f45564a02bf8ea4d8bc888377b6bb5824b80c (patch) | |
| tree | f38084d9a04fca765aeb04ecbbfa33cbbb4e72a6 /src/extension/internal/odf.cpp | |
| parent | add gray (diff) | |
| download | inkscape-327f45564a02bf8ea4d8bc888377b6bb5824b80c.tar.gz inkscape-327f45564a02bf8ea4d8bc888377b6bb5824b80c.zip | |
Fixing crash on odg save
(bzr r1094)
Diffstat (limited to 'src/extension/internal/odf.cpp')
| -rw-r--r-- | src/extension/internal/odf.cpp | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 16ff0f18f..1d3648048 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -101,27 +101,32 @@ class SVDMatrix { public: - SVDMatrix() + SVDMatrix() : + badval(0), + d(0), + rows(0), + cols(0), + size(0) { - d = (double *)0; - rows = cols = size = 0; } - SVDMatrix(unsigned int rowSize, unsigned int colSize) + SVDMatrix(unsigned int rowSize, unsigned int colSize) : + badval(0), + rows(rowSize), + cols(colSize), + size(rows * cols) { - rows = rowSize; - cols = colSize; - size = rows * cols; d = new double[size]; for (unsigned int i=0 ; i<size ; i++) d[i] = 0.0; } - SVDMatrix(double *vals, unsigned int rowSize, unsigned int colSize) + SVDMatrix(double *vals, unsigned int rowSize, unsigned int colSize) : + badval(0), + rows(rowSize), + cols(colSize), + size(rows * cols) { - rows = rowSize; - cols = colSize; - size = rows * cols; d = new double[size]; for (unsigned int i=0 ; i<size ; i++) d[i] = vals[i]; @@ -129,10 +134,16 @@ public: virtual ~SVDMatrix() { - delete d; + delete[] d; + d = 0; } - SVDMatrix(const SVDMatrix &other) + SVDMatrix(const SVDMatrix &other) : + badval(0), + d(0), + rows(0), + cols(0), + size(0) { assign(other); } @@ -207,7 +218,10 @@ private: void assign(const SVDMatrix &other) { if (d) - delete d; + { + delete[] d; + d = 0; + } rows = other.rows; cols = other.cols; size = other.size; @@ -259,9 +273,13 @@ public: @return Structure to access U, S and V. */ - SingularValueDecomposition (const SVDMatrix &mat) + SingularValueDecomposition (const SVDMatrix &mat) : + A(mat), + U(), + s(0), + s_size(0), + V() { - A = mat; calculate(); } @@ -284,8 +302,7 @@ public: /** * Return the s[index] value - */ - double getS(unsigned int index); + */ double getS(unsigned int index); /** * Two norm |
