From 47781848e72d383df9060cbdaa9c7922f0346e28 Mon Sep 17 00:00:00 2001 From: Brian Ferguson Date: Sun, 5 Aug 2012 06:27:07 -0600 Subject: [PATCH] Fixed how meters are initialized to avoid problems with referencing a Dynamic Section Variable before its meter options are read --- Library/MeterWindow.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 8df67f0c..6bf3bf3f 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2181,9 +2181,6 @@ bool CMeterWindow::ReadSkin() { CMeter* meter = *iter; m_Meters.push_back(meter); - - meter->ReadOptions(m_Parser); - meter->Initialize(); meter->SetRelativeMeter(prevMeter); if (!meter->GetToolTipText().empty()) @@ -2199,8 +2196,8 @@ bool CMeterWindow::ReadSkin() prevMeter = meter; } - // Initialize measures. This is a separate loop to avoid errors caused by - // referencing not-yet-existent [measures] in the options. + // Initialize measures. Separate loop to avoid errors caused by + // referencing nonexistent [measures] in the measure options. for (auto iter = measures.cbegin(); iter != measures.cend(); ++iter) { CMeasure* measure = *iter; @@ -2208,6 +2205,15 @@ bool CMeterWindow::ReadSkin() measure->Initialize(); } + // Initialize meters. Separate loop to avoid errors caused by referencing + // nonexistent [Measures:] in the meter options. (Dynamic Section Variables) + for (auto iter = meters.cbegin(); iter != meters.cend(); ++iter) + { + CMeter* meter = *iter; + meter->ReadOptions(m_Parser); + meter->Initialize(); + } + if (m_Meters.empty()) { std::wstring text = GetFormattedString(ID_STR_NOMETERSINSKIN, m_FolderPath.c_str(), m_FileName.c_str());