private SectionRecord EnsureSectionRecordImpl(string configKey, bool permitErrors, bool checkIfLocked) {
SectionRecord sectionRecord = GetSectionRecord(configKey, permitErrors);
if (sectionRecord == null) {
bool sectionAdded = false;
lock (this) {
if (_sectionRecords == null) {
_sectionRecords = new Hashtable();
}
else {
sectionRecord = GetSectionRecord(configKey, permitErrors);
}
if (sectionRecord == null) {
sectionRecord = new SectionRecord(configKey);
_sectionRecords.Add(configKey, sectionRecord);
sectionAdded = true;
}
}
if (checkIfLocked && sectionAdded) {
sectionRecord.Locked = IsParentCausingLock(configKey);
}
}
return sectionRecord;
}