diff --git a/src/effect_matrix.cpp b/src/effect_matrix.cpp index f12b158..e2ab435 100644 --- a/src/effect_matrix.cpp +++ b/src/effect_matrix.cpp @@ -144,13 +144,19 @@ MatrixEffect::MatrixEffect() { } RandomMatrixEffect::RandomMatrixEffect() { - _columns = new MatrixEffectColumn* [window->width]; - for (int i=0; iwidth; i++) _columns[i] = new RandomMatrixEffectColumn(window, random8(4), true); + // No need to initialize _columns, because that will have been done by ctor of MatrixEffect. + for (int i=0; iwidth; i++) { + delete _columns[i]; + _columns[i] = new RandomMatrixEffectColumn(window, random8(4), true); + } } RainbowMatrixEffect::RainbowMatrixEffect() { - _columns = new MatrixEffectColumn* [window->width]; - for (int i=0; iwidth; i++) _columns[i] = new RainbowMatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH); + // No need to initialize _columns, because that will have been done by ctor of MatrixEffect. + for (int i=0; iwidth; i++) { + delete columns[i]; + _columns[i] = new RainbowMatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH); + } } MatrixEffect::~MatrixEffect() {