From e0ea862d72bb31ff25786798c03cb00ac11377d3 Mon Sep 17 00:00:00 2001 From: spx Date: Tue, 8 Jun 2010 23:09:18 +0000 Subject: [PATCH] Fixed r432 issue. (Issue 158) --- Library/MeterHistogram.cpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/Library/MeterHistogram.cpp b/Library/MeterHistogram.cpp index 772dc912..d8c8ba21 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -206,15 +206,28 @@ void CMeterHistogram::Initialize() // Reset current position m_MeterPos = 0; - // Create buffers for values - if (m_PrimaryValues) delete [] m_PrimaryValues; - m_PrimaryValues = new double[m_W]; - memset(m_PrimaryValues, 0, sizeof(double) * m_W); - if (m_SecondaryMeasure) + // Delete buffers + if (m_PrimaryValues) { - if (m_SecondaryValues) delete [] m_SecondaryValues; - m_SecondaryValues = new double[m_W]; - memset(m_SecondaryValues, 0, sizeof(double) * m_W); + delete [] m_PrimaryValues; + m_PrimaryValues = NULL; + } + if (m_SecondaryValues) + { + delete [] m_SecondaryValues; + m_SecondaryValues = NULL; + } + + // Create buffers for values + if (m_W > 0) + { + m_PrimaryValues = new double[m_W]; + memset(m_PrimaryValues, 0, sizeof(double) * m_W); + if (m_SecondaryMeasure) + { + m_SecondaryValues = new double[m_W]; + memset(m_SecondaryValues, 0, sizeof(double) * m_W); + } } m_WidthChanged = false; @@ -283,6 +296,10 @@ void CMeterHistogram::ReadConfig(const WCHAR* section) } } } + else + { + m_WidthChanged = true; + } } /*